Ticket #9939 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

"TypeError: generate() keywords must be strings" Python 2.6 and trac 0.12

Reported by: margineanu.andrei@gmail.com Assigned to: martin_s
Priority: normal Component: WatchlistPlugin
Severity: normal Keywords: typeerror python
Cc: rjollos Trac Release: 0.12

Description

Hi, We installed the WatchlistPlugin on our company server after making the update to trac 0.12. When watching any wiki page the following error occurs:

TypeError: generate() keywords must be strings

  • in : "<path>/egg/trac/web/chrome.py", line 812, in render_template
  • line 812: stream = template.generate(**data)
  • data: {'datetime_format': u'%Y-%m-%d %H:%i:%s', 'all': <built-in function all>, ...

It might be related to the python handling of unicode strings. See here and and here.

Thanks in advance.

Attachments

Change History

04/04/12 00:31:44 changed by rjollos

  • cc set to rjollos.

04/04/12 09:15:09 changed by martin_s

Looks indeed that one of the keywords is in unicode and not a string. I have the feeling that this is only an issue with Python 2.6 and not with 2.7. Please check your log file for a trace-back and post it here. This would help me. Thanks.

04/04/12 09:50:21 changed by anonymous

Hi,

Thanks a lot for the quick update. Here is the log:

2012-04-04 10:47:56,711 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "build/bdist.linux-i686/egg/trac/web/main.py", line 513, in _dispatch_request
    dispatcher.dispatch(req)
  File "build/bdist.linux-i686/egg/trac/web/main.py", line 256, in dispatch
    content_type)
  File "build/bdist.linux-i686/egg/trac/web/chrome.py", line 812, in render_template
    stream = template.generate(**data)
TypeError: generate() keywords must be strings

04/05/12 09:22:24 changed by martin_s

Strange, the tracelog should go all the way to the plugin. I was hoping to find the exact location in the plugin source code this way.

04/05/12 10:32:39 changed by martin_s

  • status changed from new to assigned.

I now changed the code to ensure that the keywords are strings. Please try r11452 and tell me if it fixes the issue. Note that I can't replicate the error with Python 2.6.7 or 2.7.2+. Would you be able to update your Python installation, at least to a higher 2.6.x version?

04/05/12 13:26:16 changed by anonymous

Hi, Thank you for the update. I tried the fix but now I get a different error:

NameError: global name 'wldict' is not defined

in line 419: wldict['action'] = action

The Python version will not be updated because of the possible risks, so we're stuck with it - 2.6 r26:66714, Dec 3 2008, 06:05:48.

I think it's no longer a problem of the plugin. You can close the ticket.

Thank you.

04/05/12 16:16:41 changed by martin_s

Sorry, there was a minor error in my last change. Try r11454, which should work.

04/09/12 21:51:47 changed by anonymous

Hi,

Thanks a lot for the update, the fix works great :)

Best regards, Andrei.

04/10/12 11:05:52 changed by martin_s

  • status changed from assigned to closed.
  • resolution set to fixed.

Add/Change #9939 ("TypeError: generate() keywords must be strings" Python 2.6 and trac 0.12)




Change Properties
Action