Ticket #235 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Links generated by Macro are invalid

Reported by: mjlucas@eng.uts.edu.au Assigned to: jornh
Priority: normal Component: PlannedMilestonesMacro
Severity: normal Keywords:
Cc: avif@arc90.com Trac Release:

Description

os.getenv('HTTP_HOST') is retutning 'None' and therefore links generated are invalid.

Any ideas on this matter?

Attachments

Change History

03/31/06 11:08:14 changed by avif@arc90.com

  • cc set to avif@arc90.com.

Replace these lines:

        out.write('<li> %s - <a href="http://%s%s">%s</a>\n' %
                  (date, os.getenv('HTTP_HOST'),
                   env.href.milestone(name), name))

(which I believe are 29-31)

with these:

        out.write('<li> %s - <a href="%s">%s</a>\n' %
                  (date, env.href.milestone(name), name))

I've also patched my copy with the patch from #213. Here's my complete file:

from StringIO import StringIO
import re
from time import localtime, strftime, time
import os

def execute(hdf, txt, env):
    out = StringIO()
    db = env.get_db_cnx()

    query = "SELECT name, due, description FROM milestone " \
            "WHERE name != '' " \
            "AND (due IS NULL OR due = 0 OR due > %d) " \
            "ORDER BY (due IS NULL) ASC, due ASC, name" % time()

    cursor = db.cursor()
    cursor.execute(query)
    out.write('<ul>\n')
    while True:
        row = cursor.fetchone()
        if not row:
            break
        name = row[0]
        if row[1] > 0:
            date = strftime('%x', localtime(row[1]))
        else:
            date = "<i>(later)</i>"
        if name == "":
            continue

        out.write('<li> %s - <a href="%s">%s</a>\n' %
                  (date, env.href.milestone(name), name))

    out.write('</ul>\n')
    return out.getvalue()

05/30/06 23:24:54 changed by mgood

  • status changed from new to closed.
  • resolution set to fixed.

(In [796]) * use the Milestone model API to be cross-DB compatible and preserve proper sorting (fixes #158, #213, #235, #398)

  • use Markup to make sure HTML is properly escaped for output

Add/Change #235 (Links generated by Macro are invalid)




Change Properties
Action