TracHours plugin - updating for Trac 1.6 - AttributeError: 'str' object has no attribute 'setdefault'

24 views
Skip to first unread message

Rob Hills

unread,
Aug 3, 2025, 2:22:53 AMAug 3
to trac-hacks
I'm using https://trac.edgewall.org/wiki/TracDev/PortingFromGenshiToJinja as a guide to help me update the TracHours plugin to work with Trac 1.6

I have implemented the IRequestFilter interface and added a post_process_request() method which returns three results:  template, data and content_type, as shown in the Porting from Genshi to Jinja howto.  The content_type variable is passed in via the method call and not altered, and is the string "text/html"

However, when this gets processed via trac.web.main here, the content_type variable returned by the post_process_request() method gets transferred into the metadata variable and a few lines down here, the code expects metadata to have a "setdefault" method.  As it's a string, it doesn't have this method and hence throws the AttributeError "''str' object has no attribute 'setdefault'".

I suspect I'm doing something wrong in my code, but I'm not sure what!

Rob Hills
Waikiki, Western Australia
Reply all
Reply to author
Forward
0 new messages