Modify ↓
Opened 20 years ago
Closed 19 years ago
#235 closed defect (fixed)
Links generated by Macro are invalid
| Reported by: | Owned by: | jornh | |
|---|---|---|---|
| Priority: | normal | Component: | PlannedMilestonesMacro |
| Severity: | normal | Keywords: | |
| Cc: | avif@… | Trac Release: |
Description
os.getenv('HTTP_HOST') is retutning 'None' and therefore links generated are invalid.
Any ideas on this matter?
Attachments (0)
Note: See
TracTickets for help on using
tickets.



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