Author: dmeyer
Date: Wed Mar 22 16:18:46 2006
New Revision: 1317
Modified:
trunk/epg/src/__init__.py
trunk/epg/src/client.py
Log:
handle disconnection
Modified: trunk/epg/src/__init__.py
==============================================================================
--- trunk/epg/src/__init__.py (original)
+++ trunk/epg/src/__init__.py Wed Mar 22 16:18:46 2006
@@ -1,3 +1,5 @@
+import logging
+
from kaa.db import QExpr
from channel import Channel
@@ -7,23 +9,22 @@
from util import cmp_channel
__all__ = [ 'connect', 'Channel', 'Program', 'Client', 'Server', 'QExpr',
- 'get_channels', 'search' ]
+ 'get_channels', 'get_channel', 'search' ]
+
+log = logging.getLogger('epg')
# connected client object
-guide = None
-_address = None
+guide = None
def connect(address, auth_secret=None):
"""
"""
global guide
- global _address
- if guide and guide.connected and _address == address:
- return guide
+ if guide and guide.connected:
+ log.warning('connecting to a new epg database')
guide = Client(address, auth_secret)
- _address = address
return guide
@@ -46,5 +47,8 @@
def search(*args, **kwargs):
if guide:
- return guide.search(*args, **kwargs)
+ try:
+ return guide.search(*args, **kwargs)
+ except Exception, e:
+ log.exception('kaa.epg.search failed')
return []
Modified: trunk/epg/src/client.py
==============================================================================
--- trunk/epg/src/client.py (original)
+++ trunk/epg/src/client.py Wed Mar 22 16:18:46 2006
@@ -79,6 +79,9 @@
def search(self, **kwargs):
+ if not self.connected:
+ return []
+
if "channel" in kwargs:
ch = kwargs["channel"]
if type(ch) == Channel:
@@ -163,6 +166,9 @@
return self._channels_list
def update(self, *args, **kwargs):
+ if not self.connected:
+ return False
+
# updated signal will fire when this call completes.
kwargs["__ipc_oneway"] = True
kwargs["__ipc_noproxy_args"] = True
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog