#13992 closed defect (fixed)
Create Jinja2 templates
Reported by: | Cinc-th | Owned by: | Cinc-th |
---|---|---|---|
Priority: | normal | Component: | CustomFieldAdminPlugin |
Severity: | normal | Keywords: | |
Cc: | Ryan J Ollos | Trac Release: | 1.4 |
Description
Use of Genshi is deprecated and no longer supported with Trac > 1.5.
Convert template to Jinja2.
@rjollos:
Should I attach a patch or will you give me (temporary) write access to this plugin?
Attachments (1)
Change History (12)
comment:1 Changed 4 years ago by
comment:2 Changed 4 years ago by
Owner: | changed from osimons to Cinc-th |
---|---|
Status: | new → assigned |
comment:4 follow-up: 5 Changed 4 years ago by
I think we should create 1.4 branch requiring Trac>=1.3
and unable to make compatible with both 1.4 and 1.2.
comment:5 Changed 4 years ago by
I think we should create 1.4 branch requiring
Trac>=1.3
and unable to make compatible with both 1.4 and 1.2.
Ah, sorry. I misunderstood commit message. The changes seem to be compatible with both 1.4 and 1.2.
Minor thing, we could check jenv
attribute without creating a Chrome instance.
- if hasattr(Chrome(self.env), 'jenv'): + if hasattr(Chrome, 'jenv'):
Changed 4 years ago by
Attachment: | t13992-jinja2-l10n.diff added |
---|
comment:6 Changed 4 years ago by
L10N with Trac 1.4.x doesn't work.
- <h2>${_("Manage Custom Fields")}</h2> + <h2>${dgettext(domain, "Manage Custom Fields")}</h2>
We should use dgettext()
instead of _()
in templates of plugins.
- return 'customfieldadmin_jinja.html', cf_admin, {'domain': 'customfieldadmin'} + cf_admin['domain'] = 'customfieldadmin' + return 'customfieldadmin_jinja.html', cf_admin
Also, 3rd parameter shouldn't be used. Otherwise, dgettext()
leads the following exception.
<h2>${dgettext(domain, "Manage Custom Fields")}</h2> File "/home/jun66j5/venv/trac/1.4.2/local/lib/python2.7/site-packages/trac/util/translation.py", line 295, in <lambda> return lambda *args, **kw: _functions[symbol](domain, *args, **kw) KeyError: 'dgettext'
comment:7 Changed 4 years ago by
<h2>${_("Manage Custom Fields")}</h2>
works for me. I see the german translations on my system.
And it's what's described here: trac:TracDev/PortingFromGenshiToJinja#trans
But I'm no expert here...
comment:8 Changed 3 years ago by
Hi All,
I am on Trac 1.5.3 using this plugin:
Fix for me was
+ cf_admin['domain'] = 'customfieldadmin' + return 'customfieldadmin_jinja.html', cf_admin
This did not fix the issue:
<h2>${_("Manage Custom Fields")}</h2>
comment:9 Changed 3 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
See above for 1.5.x fix
Replying to Cinc-th:
rw
access granted for entire repository. Please feel free to proceed with any commits after confirming checking with the plugin author, of which very few are around these days.