Changeset 2769

Show
Ignore:
Timestamp:
11/11/07 14:40:11 (1 year ago)
Author:
gotoh
Message:

Fix to work with trac 0.11 (r1921 was not enough).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ticketboxmacro/0.11/TicketBox.py

    r2768 r2769  
    5858    return "'%s'" % x.replace( "'","''" ) 
    5959 
    60 def execute(hdf, txt, env): 
     60def execute(formatter, args): 
     61    txt = args 
     62    req = formatter.req 
     63    env = formatter.env 
    6164    if not txt: 
    6265        txt = '' 
     
    8285            # username, do not override if specified 
    8386            if not dv.has_key('USER'): 
    84                 dv['USER'] = hdf.getValue('trac.authname', 'anonymous') 
     87                dv['USER'] = req.authname 
    8588            if match.group('dv'): 
    8689                for expr in string.split(match.group('dv')[1:], '&'): 
     
    114117    items.sort() 
    115118    html = '' 
    116     try: 
    117         # for trac 0.9 or later 
    118         from trac.wiki.formatter import wiki_to_oneliner 
    119         html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "), 
    120                                env, env.get_db_cnx()) 
    121     except: 
    122         # for trac 0.8.x 
    123         from trac.WikiFormatter import wiki_to_oneliner 
    124         html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "), 
    125                                 hdf, env, env.get_db_cnx()) 
     119    from trac.wiki.formatter import wiki_to_oneliner, wiki_to_outline 
     120    html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "), 
     121                            env, env.get_db_cnx(), req=formatter.req) 
    126122    if html != '': 
    127123        try: 
     
    135131        return '' 
    136132 
    137 # trac version 0.11 and up compatibility 
    138133 
    139134from trac.wiki.macros import WikiMacroBase 
     
    150145          [[HelloWorld]]), then `args` is `None`. 
    151146        """ 
    152         return execute(formatter.req.hdf, args, formatter.env
     147        return execute(formatter, args