Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transfer arugments for Plugin.finish from view_func (update_listing e.g.) #91

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions xbmcswift2/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
import os
import sys
import pickle
import types
import xbmcswift2
from urllib import urlencode
from functools import wraps
from collections import Iterable
from optparse import OptionParser
try:
from urlparse import parse_qs
Expand Down Expand Up @@ -303,18 +305,18 @@ def _dispatch(self, path):
continue
log.info('Request for "%s" matches rule for function "%s"',
path, view_func.__name__)
listitems = view_func(**items)
response = view_func(**items)

# Only call self.finish() for UI container listing calls to plugin
# (handle will be >= 0). Do not call self.finish() when called via
# RunPlugin() (handle will be -1).
if not self._end_of_directory and self.handle >= 0:
if listitems is None:
self.finish(succeeded=False)
else:
listitems = self.finish(listitems)
if isinstance(response, types.DictType):
response['items'] = self.finish(**response)
elif isinstance(response, Iterable):
response = self.finish(items=response)

return listitems
return response
raise NotFoundException, 'No matching view found for %s' % path

def redirect(self, url):
Expand Down