OK thanks Ryan.

I'm facing some final problems with Genshi templates in Trac 1.4.3.

It looks like Trac is trying to render my templates with Jinja2 instead of
Genshi...

Is there anything I should do to force Genshi to render my templates?

Here is the stack trace:

18:47:17 Trac[main] DEBUG: Rendering response with template
testmanagerstats.html
18:47:17 Trac[web_ui] DEBUG: TestManagerTemplateProvider init
18:47:17 Trac[wiki] DEBUG: WikiTestManagerInterface init
18:47:17 Trac[workflow] DEBUG: TestManagerWorkflowInterface init
18:47:17 Trac[chrome] ERROR: Jinja2 UndefinedError error while rendering
XML/HTML template
Traceback (most recent call last):
  File
"/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/trac/web/chrome.py",
line 1706, in _iterable_jinja_content
    for chunk in stream:
  File
"/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/jinja2/environment.py",
line 1357, in __next__
    return self._next()
  File
"/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/jinja2/environment.py",
line 1334, in _buffered_generator
    c = next(self._gen)
  File
"/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/jinja2/environment.py",
line 1125, in generate
    yield self.environment.handle_exception()
  File
"/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/jinja2/environment.py",
line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File
"/home/roberto/.cache/Python-Eggs/TestManager-1.10.3-py2.7.egg-tmp/testmanager/templates/testmanagerstats.html",
line 125, in top-level template code
    <option value="${m['planid']}|${m['catpath']}">${m['name']}</option>
  File
"/home/roberto/Documenti/build/pve-trac14-vero/lib/python2.7/site-packages/jinja2/environment.py",
line 452, in getitem
    return obj[argument]
UndefinedError: 'm' is undefined


And the relevant template code, where it looks like the "py:for" directive
is not understood nor run:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:xi="http://www.w3.org/2001/XInclude";
xmlns:i18n="http://genshi.edgewall.org/i18n";
xmlns:py="http://genshi.edgewall.org/";
i18n:domain="testmanager"
>
<xi:include href="layout.html" />
<xi:include href="macros.html" />

# import 'macros.html' as jmacros with context

[...]
<select id="testplan" name="testplan">
<option value="__all">All Test Plans</option>
<py:for each="m in testplans">
<option value="${m['planid']}|${m['catpath']}">${m['name']}</option>
</py:for>
</select>


And the code I use to render the template:

class TestStatsPlugin(Component):
implements(INavigationContributor, IRequestHandler, ITemplateProvider,
IPermissionRequestor)

[...]
def process_request(self, req):
[...]
return 'testmanagerstats.html', data


Any help is appreciated. Thanks.
Roberto



Il giorno lun 14 mar 2022 alle ore 18:12 RjOllos <rjol...@gmail.com> ha
scritto:

>
>
> On Monday, March 14, 2022 at 10:09:29 AM UTC-7 sec...@gmail.com wrote:
>
>> Unfortunately you are right, there's still some incompatibility with Trac
>> 1.4.x, which I didn't spot because of an incorrect setup of my test
>> environment... I was actually testing against a Trac 1.2.x instead... My
>> bad.
>>
>> I fixed most of the problems last night and I'm almost ready for a new
>> release. I just want to perform more extensive tests with Trac versions
>> 1.2, 1.3 and 1.4.
>>
>> A question for Ryan, though: how old Trac versions do you think it still
>> makes sense to support? Will it be ok to stop at 1.2 or you think I should
>> go even backward?
>>
>> Regards.
>> Roberto
>>
>
> Supporting back to 1.2 is probably fine since the old version works with
> 1.0. The 1.4 and 1.5 release lines are currently the only that are
> maintained.
>
> Ryan
>
> --
> 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 on the web visit
> https://groups.google.com/d/msgid/trac-users/fe8ac504-e056-46f4-86ee-3933cf83dfcbn%40googlegroups.com
> <https://groups.google.com/d/msgid/trac-users/fe8ac504-e056-46f4-86ee-3933cf83dfcbn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/trac-users/CAJkkV1Exakykj4humfV5ww1DH7Ndcv3RZV8LEcM%3DN0-%2BkPmcow%40mail.gmail.com.

Reply via email to