Modify

Opened 18 years ago

Closed 18 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:

Description

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

comment:2 Changed 18 years ago by Matt Good

Resolution: fixed
Status: newclosed

(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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain jornh.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.