Modify ↓
Opened 19 years ago
Closed 13 years ago
#1330 closed defect (wontfix)
Queries with no result record causes internal error
| Reported by: | Akihiro KAYAMA | Owned by: | Noah Kantrowitz |
|---|---|---|---|
| Priority: | normal | Component: | PaginateTicketsPlugin |
| Severity: | normal | Keywords: | |
| Cc: | Trac Release: | 0.10 |
Description
Queries with no result record like query:?status=reopened causes internal error
Traceback (most recent call last):
File "/usr/pkg/lib/python2.4/site-packages/trac/web/main.py", line 379, in dispatch_request
dispatcher.dispatch(req)
File "/usr/pkg/lib/python2.4/site-packages/trac/web/main.py", line 232, in dispatch
template, content_type = self._post_process_request(req,
File "/usr/pkg/lib/python2.4/site-packages/trac/web/main.py", line 262, in _post_process_request
content_type)
File "/usr/pkg/lib/python2.4/site-packages/TracPaginateTickets-0.1-py2.4.egg/paginate/web_ui.py", line 42, in post_process_request
results_dict = walk_hdf(req.hdf.getObj('query.results').child())
AttributeError: 'NoneType' object has no attribute 'child'
Attachments (0)
Change History (2)
comment:1 Changed 19 years ago by
comment:2 Changed 13 years ago by
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
This plugin is deprecated with Trac 0.11. The functionality was integrated to the Trac core in t:#216.
Note: See
TracTickets for help on using
tickets.



Following patch will solve this problem. (includes ticket:1306 patch)
--- paginateticketsplugin/0.10/paginate/web_ui.py.orig 2006-09-04 02:54:38.000000000 +0900 +++ paginateticketsplugin/0.10/paginate/web_ui.py 2007-03-14 20:27:27.000000000 +0900 @@ -39,8 +39,12 @@ ret[node.name()] = node.value() node = node.next() return ret - results_dict = walk_hdf(req.hdf.getObj('query.results').child()) - results = [results_dict[k] for k in sorted(results_dict.keys())] + results = [] + root = req.hdf.getObj('query.results') + if root is not None: + results_dict = walk_hdf(root.child()) + results = [results_dict[str(k)] for k in + sorted([int(key) for key in results_dict.keys()])] # Update/retrieve the number of tickets per page perpage = req.session.get('tickets_perpage') @@ -50,7 +54,10 @@ perpage = int(perpage) # Calculate number of pages and current page - numpages = int(math.ceil(len(results) * 1.0 / perpage)) + if len(results) == 0: + numpages = 1 + else: + numpages = int(math.ceil(len(results) * 1.0 / perpage)) curpage = int(req.args.get('page', 1)) if curpage <= 0 or curpage > numpages: raise TracError, 'Invalid page %s'%(curpage)