Changeset 2817

Show
Ignore:
Timestamp:
11/23/07 18:44:40 (1 year ago)
Author:
osimons
Message:

AddCommentMacro: Fixing some unicode issues with 0.10 version.

Fixes #766

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • addcommentmacro/0.10/addcomment/macro.py

    r2097 r2817  
    3232    hdf['addcommentmacro'] = True 
    3333 
    34     authname = hdf.getValue("trac.authname", "anonymous"
     34    authname = to_unicode(hdf.getValue("trac.authname", "anonymous")
    3535    db = env.get_db_cnx() 
    3636    perm = trac.perm.PermissionCache(env, authname) 
     
    5656    submit = hdf.getValue("args.submitaddcomment", "") 
    5757    if not cancel: 
    58         authname = hdf.getValue("args.authoraddcomment", authname
     58        authname = to_unicode(hdf.getValue("args.authoraddcomment", authname)
    5959 
    6060    # Ensure [[AddComment]] is not present in comment, so that infinite 
     
    7070        if preview: 
    7171            out.write("<div class='wikipage' id='preview'>\n") 
    72         out.write("<h4 id='commentpreview'>Comment by %s on %s</h4>\n<p>\n%s\n</p>\n" % (authname, time.strftime('%c', time.localtime()), wiki_to_html(comment, env, None))) 
     72        out.write("<h4 id='commentpreview'>Comment by %s on %s</h4>\n<p>\n%s\n</p>\n" % ( 
     73                    authname, to_unicode(time.strftime('%c', time.localtime())), 
     74                    wiki_to_html(comment, env, None))) 
    7375        if preview: 
    7476            out.write("</div>\n") 
     
    8082        for line in page.text.splitlines(): 
    8183            if line.find('[[AddComment') == 0: 
    82                 newtext.write("==== Comment by %s on %s ====\n%s\n\n" % (authname, time.strftime('%c', time.localtime()), comment)) 
     84                newtext.write("==== Comment by %s on %s ====\n%s\n\n" % ( 
     85                        authname, to_unicode(time.strftime('%c', time.localtime())), 
     86                        comment)) 
    8387                submitted = True 
    8488            newtext.write(line + "\n")