Modify

Opened 8 years ago

Closed 8 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 8 years ago by avif@…

  • Cc avif@… added

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 8 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

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from jornh. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.