diff options
| author | Devendra | 2014-04-23 12:54:16 +0530 |
|---|---|---|
| committer | Devendra | 2014-04-23 12:54:16 +0530 |
| commit | fdb46e56fa6794940f9fbe51a2863d58e927e655 (patch) | |
| tree | 99d71159c47858aaa17b31b77d4e5a153c2153cf /common/PubnubCoreAsync.py | |
| parent | 69240816755406b26b364f37ca521fdb269581d1 (diff) | |
| download | pubnub-python-fdb46e56fa6794940f9fbe51a2863d58e927e655.tar.bz2 | |
switching to positional arguments
Diffstat (limited to 'common/PubnubCoreAsync.py')
| -rw-r--r-- | common/PubnubCoreAsync.py | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/common/PubnubCoreAsync.py b/common/PubnubCoreAsync.py index db10575..deb6038 100644 --- a/common/PubnubCoreAsync.py +++ b/common/PubnubCoreAsync.py @@ -101,7 +101,7 @@ class PubnubCoreAsync(PubnubBase): for i in l: func(i) - def subscribe( self, args=None, sync=False ) : + def subscribe( self, channel, callback, error=None, connect=None, disconnect=None, reconnect=None, sync=False ) : """ #** #* Subscribe @@ -133,27 +133,11 @@ class PubnubCoreAsync(PubnubBase): }) """ - if args is None: - _invoke(error, "Arguments Missing") - return - channel = args['channel'] if 'channel' in args else None - callback = args['callback'] if 'callback' in args else None - connect = args['connect'] if 'connect' in args else None - disconnect = args['disconnect'] if 'disconnect' in args else None - reconnect = args['reconnect'] if 'reconnect' in args else None - error = args['error'] if 'error' in args else None with self._tt_lock: self.last_timetoken = self.timetoken if self.timetoken != 0 else self.last_timetoken self.timetoken = 0 - if channel is None: - _invoke(error, "Channel Missing") - return - if callback is None: - _invoke(error, "Callback Missing") - return - if sync is True and self.susbcribe_sync is not None: self.susbcribe_sync(args) return @@ -184,16 +168,6 @@ class PubnubCoreAsync(PubnubBase): chobj = self.subscriptions[ch] _invoke(chobj['error'],err) - ''' - if callback is None: - _invoke(error, "Callback Missing") - return - - if channel is None: - _invoke(error, "Channel Missing") - return - ''' - def _get_channel(): for ch in self.subscriptions: chobj = self.subscriptions[ch] @@ -290,14 +264,11 @@ class PubnubCoreAsync(PubnubBase): self._connect() - def unsubscribe( self, args ): + def unsubscribe( self, channel ): - if 'channel' in self.subscriptions is False: + if channel in self.subscriptions is False: return False - channel = str(args['channel']) - - ## DISCONNECT with self._channel_list_lock: if channel in self.subscriptions: |
