I'm using https://trac.edgewall.org/wiki/TracDev/PortingFromGenshiToJinja 
as a guide to help me update the TracHours plugin 
<https://trac-hacks.org/wiki/TracHoursPlugin> 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 
<https://trac.edgewall.org/wiki/TracDev/PortingFromGenshiToJinja#ImplementIRequestFilter.post_process_requesttoconditionallyaddJavaScriptcode>.
  
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 
<https://github.com/edgewall/trac/blob/0dde63bb84da28ad87f1a3d3d7bea7b55d415620/trac/web/main.py#L250>,
 
the content_type variable returned by the post_process_request() method 
gets transferred into the metadata variable and a few lines down here 
<https://github.com/edgewall/trac/blob/0dde63bb84da28ad87f1a3d3d7bea7b55d415620/trac/web/main.py#L264>,
 
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


On Wednesday, 27 August 2025 at 01:16:21 UTC+8 RjOllos wrote:

> On Tuesday, August 26, 2025 at 5:45:49 AM UTC-7 rcp....@gmail.com wrote:
>
> I posted this 
> <https://groups.google.com/g/trac-hacks/c/_FJQMrNekZQ/m/FZ81e_N-AAAJ> on 
> the Trac Hacks group but got no replies.  Is that group still going?
>
>
> It's dead.
>  
>
>
> Should I post the original query here instead?
>
>
> Yes, please do. 
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/trac-users/3341c5e4-b7a9-4d44-b121-daba8f3a05ecn%40googlegroups.com.

Reply via email to