diff options
| author | Simeon Simeonov | 2015-04-17 16:23:19 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2015-04-17 16:23:19 +0200 |
| commit | 0e04cd072018eaa121ff75f20f8f9a5a5d7b0919 (patch) | |
| tree | f5512928cc6d7a9d28eb697574ea3a67e33f61f0 | |
| parent | c7e57ae16ea9024ec55f401a18158c09bc45a1a3 (diff) | |
Fix a nasty proxy-object bug
| -rw-r--r-- | beinc_weechat.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/beinc_weechat.py b/beinc_weechat.py index 5082c1d..73261dd 100644 --- a/beinc_weechat.py +++ b/beinc_weechat.py | |||
| @@ -159,6 +159,7 @@ class WeechatTarget(object): | |||
| 159 | target_dict.get('disable-hostname-check', False)) | 159 | target_dict.get('disable-hostname-check', False)) |
| 160 | self.__ssl_version = target_dict.get('ssl_version', 'auto') | 160 | self.__ssl_version = target_dict.get('ssl_version', 'auto') |
| 161 | self.__connection = None # xmlrpclib.ServerProxy instance | 161 | self.__connection = None # xmlrpclib.ServerProxy instance |
| 162 | self.__connection_setup() | ||
| 162 | 163 | ||
| 163 | @property | 164 | @property |
| 164 | def name(self): | 165 | def name(self): |
| @@ -331,11 +332,11 @@ class WeechatTarget(object): | |||
| 331 | def __connection_setup(self): | 332 | def __connection_setup(self): |
| 332 | """ | 333 | """ |
| 333 | """ | 334 | """ |
| 334 | if self.__connection: | 335 | if self.__connection is not None: |
| 335 | return True | 336 | return True |
| 336 | if self.__debug: | 337 | if self.__debug: |
| 337 | beinc_prnt( | 338 | beinc_prnt( |
| 338 | 'BEINC DEBUG: (Re)Establishing connection to: {0}'.format( | 339 | 'BEINC DEBUG: Establishing proxy-connection to: {0}'.format( |
| 339 | self.__url)) | 340 | self.__url)) |
| 340 | try: | 341 | try: |
| 341 | ssl_version = BEINC_SSL_METHODS.get(self.__ssl_version, | 342 | ssl_version = BEINC_SSL_METHODS.get(self.__ssl_version, |
| @@ -415,7 +416,7 @@ class WeechatTarget(object): | |||
| 415 | XMLRPC request | 416 | XMLRPC request |
| 416 | """ | 417 | """ |
| 417 | try: | 418 | try: |
| 418 | if not self.__connection and not self.__connection_setup(): | 419 | if self.__connection is None and not self.__connection_setup(): |
| 419 | return False | 420 | return False |
| 420 | if self.__socket_timeout: | 421 | if self.__socket_timeout: |
| 421 | socket.setdefaulttimeout(self.__socket_timeout) | 422 | socket.setdefaulttimeout(self.__socket_timeout) |
| @@ -696,9 +697,9 @@ def beinc_init(): | |||
| 696 | 697 | ||
| 697 | weechat.register( | 698 | weechat.register( |
| 698 | 'beinc_weechat', | 699 | 'beinc_weechat', |
| 699 | 'Simeon Simeonov', | 700 | __author__, |
| 700 | '1.0', | 701 | __version__, |
| 701 | 'GPL3', | 702 | __license__, |
| 702 | 'Blackmore\'s Extended IRC Notification Collection (Weechat Client)', | 703 | 'Blackmore\'s Extended IRC Notification Collection (Weechat Client)', |
| 703 | '', | 704 | '', |
| 704 | '') | 705 | '') |
