#7216 closed defect (fixed)
TracQuery macro failing with {'stylesheet': ...} has no member named 'next'
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | wiki system | Version: | 0.11rc1 |
Severity: | normal | Keywords: | macro |
Cc: | davidf@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
These errors started appearing after an upgrade from an earlier 0.11 release to the latest svn (just after rc1 - r7003 on the 0.11 branch):
Error: Macro TicketQuery(iteration=current&status!=closed&type!=specification|responsibility|project&col=id&col=summary&col=status&col=type&col=priority&col=milestone&order=priority&group=owner,format=table) failed {'stylesheet': [{'href': '/chrome/common/css/report.css', 'type': 'text/css', 'class': None, 'title': None}]} has no member named "next"
The slightly abbreviated traceback is here:
2008-05-05 08:10:30,250 Trac[formatter] ERROR: Macro TicketQuery(iteration=current&status=closed&type!=responsibility|project&col=id&col=summary&col=status&col=type&col=priority&col=milestone&col=owner&order=priority&group=component,format=table) failed Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/trac/wiki/formatter.py", line 468, in _macro_formatter return macro.process(args, in_paragraph=True) [snip] File "/usr/lib/python2.4/site-packages/genshi/template/directives.py", line 680, in __call__ value = expr.evaluate(ctxt) File "/usr/lib/python2.4/site-packages/genshi/template/eval.py", line 136, in evaluate return eval(self.code, _globals, {'data': data}) File "/usr/lib/python2.4/site-packages/trac/templates/page_index.html", line 21, in <Expression '?'> <span py:if="paginator.has_next_page" File "/usr/lib/python2.4/site-packages/genshi/template/eval.py", line 281, in lookup_item return obj[key] File "/usr/lib/python2.4/site-packages/genshi/template/eval.py", line 236, in _die raise UndefinedError(self._name, self._owner) UndefinedError: {'stylesheet': [{'href': '/chrome/common/css/report.css', 'type': 'text/css', 'class': None, 'title': None}]} has no member named "next"
It's not entirely dependent on the query and so I suspect it's got something to do with the number of records being returned (it's from the paginator).
The actual expression generated isn't in the traceback, but in the template:
<span py:if="paginator.has_next_page" py:with="nextlink = chrome.links.next[0]" class="next">
I can help debug if some pointers are given… this is within a standard wiki page, and the TracQuery macro expression was:
TicketQuery(iteration=current&status!=closed&type!=specification|responsibility|project&col=id&col=summary&col=status&col=type&col=priority&col=milestone&order=priority&group=owner,format=table)
Attachments (0)
Change History (8)
follow-up: 2 comment:1 by , 17 years ago
comment:2 by , 17 years ago
Replying to cboos:
How many matches and how many results per page?
The error doesn't account for 90 matches, and does for 111, and the number of results per page when going through the View Tickets / custom query system is 100… This error only occurs with format=table from within a wiki page - surely the correct thing within a wiki page query is to have no paging?
comment:3 by , 17 years ago
Having looked through the code, manually setting max=0 makes this work - should this be made the default for TracQuery calls? The alternative of trying to make them do paging within a wiki page seems much more complex…
follow-up: 5 comment:4 by , 17 years ago
The idea was to allow the max
parameter to be used so that the number of tickets shown can be limited (there used to be a limit
argument), but with no pagination support (the differentiator should be req == None
in the case a Query is called from the TicketQuery macro).
comment:5 by , 17 years ago
Replying to cboos:
The idea was to allow the
max
parameter to be used so that the number of tickets shown can be limited (there used to be alimit
argument), but with no pagination support (the differentiator should bereq == None
in the case a Query is called from the TicketQuery macro).
Yes, that makes sense - req == None
is passed through to Query.template_data
, but to fix this we should probably
- handle Pagination construction differently in the
if req:
section Also theQuery
- the
Query
constructor setsmax
toitems_per_page
by default - ideally this should be done in the call to Paginator only if there is areq
But I don't know the code that well so I'm just guessing…
comment:6 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks for your feedback, the issue should be fixed now in [7055].
comment:7 by , 17 years ago
Woops, commit was on the wrong branch - I backported to 0.11-stable in [7059].
How many matches and how many results per page?