Opened 11 years ago

Closed 10 years ago

#235 closed defect (fixed)

Links generated by Macro are invalid

Reported by: mjlucas@… Owned by: jornh
Priority: normal Component: PlannedMilestonesMacro
Severity: normal Keywords:
Cc: avif@… Trac Release:


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

Any ideas on this matter?

Attachments (0)

Change History (2)

comment:1 Changed 11 years ago by avif@…

  • Cc avif@… added; anonymous removed

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()
    while True:
        row = cursor.fetchone()
        if not row:
        name = row[0]
        if row[1] > 0:
            date = strftime('%x', localtime(row[1]))
            date = "<i>(later)</i>"
        if name == "":

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

    return out.getvalue()

comment:2 Changed 10 years ago by mgood

  • Resolution set to fixed
  • Status changed from new to closed

(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 Comment

Modify Ticket

as closed The owner will remain jornh.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.