Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12950 closed defect (fixed)

'Error loading tickets.'

Reported by: ntmlod Owned by: osimons
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

I got this message just under the ticket summary but the scripts in question in the log are from XmlRpcPlugin

  File "build/bdist.linux-x86_64/egg/tracrpc/web_ui.py", line 158, in _rpc_process
    result = (XMLRPCSystem(self.env).get_method(method_name)(req, args))[0]
  File "build/bdist.linux-x86_64/egg/tracrpc/api.py", line 197, in __call__
    result = self.callable(req, *args)
  File "build/bdist.linux-x86_64/egg/tracrpc/search.py", line 60, in performSearch
    for result in source.get_search_results(req, query, filters):
ServiceException: 'NoneType' object is not iterable

Attachments (0)

Change History (9)

comment:1 Changed 8 years ago by ntmlod

I forgot the revision numbers:

Also AccountManagerPlugin 0.4.4 (r13806) is enabled too but only the API component so the standard login module is still in operation.

Last edited 8 years ago by ntmlod (previous) (diff)

comment:2 Changed 8 years ago by Jun Omae

Component: DuplicateTicketSearchPluginXmlRpcPlugin
Owner: changed from Ryan J Ollos to osimons

That is a XmlRpcPlugin issue.

The get_search_results() can return None. Please try the following patch.

See also:

  • tracrpc/search.py

    diff --git a/tracrpc/search.py b/tracrpc/search.py
    index aeba287..0c78321 100644
    a b class SearchRPC(Component): 
    5757
    5858        results = []
    5959        for source in self.search_sources:
    60             for result in source.get_search_results(req, query, filters):
     60            for result in source.get_search_results(req, query, filters) or []:
    6161                results.append(['/'.join(req.base_url.split('/')[0:3])
    6262                                + result[0]] + list(result[1:]))
    6363        return results
Last edited 8 years ago by Jun Omae (previous) (diff)

comment:3 Changed 8 years ago by ntmlod

Thanks jun66j5, it works now with your suggested patch.

comment:4 Changed 8 years ago by osimons

In my testing I cannot actually get it to fail, so must be an explanation that I cannot understand or a set of circumstances that I cannot replicate.

What would be an example of a broken search.performSearch(query, filters) call that I could test?

comment:5 in reply to:  4 Changed 8 years ago by Jun Omae

Replying to osimons:

In my testing I cannot actually get it to fail, so must be an explanation that I cannot understand or a set of circumstances that I cannot replicate.

What would be an example of a broken search.performSearch(query, filters) call that I could test?

Ah, sorry. I misunderstood. WikiModule.get_search_results() never return None because it uses yield.

However, it seems DiscussionCore.get_search_results() in DiscussionPlugin leads the issue. The module doesn't use yield. See discussionplugin/1.0/tracdiscussion/core.py@15556:155-159#L155.

comment:6 Changed 8 years ago by osimons

I see that the Trac search API is somewhat short on documentation, but it says: "Return a list of search results matching each search term in terms."

All my plugins use iterators for all cases, but it looks like Trac is patched to handle None in addition to all iterators (including empty)?

If that is the case then I suppose RPC better to it too, and just gracefully handle "bugs" in other plugins... :-)

comment:7 Changed 8 years ago by osimons

Resolution: fixed
Status: newclosed

In 15968:

XmlRpcPlugin: Make search gracefully handle None result where iterator was expected. Closes #12950.

Fix includes a test case that provokes the error and verifies the fix.

comment:8 Changed 8 years ago by osimons

Thanks for report + patch!

comment:9 Changed 8 years ago by osimons

In 15969:

XmlRpcPlugin: Improve test case docs. Follow-up to [15968]. Refs. #12950.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.