summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-03-26 09:21:50 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-03-26 09:21:50 (GMT)
commit7566d1439506543bdf885a3350e4363dde109fdd (patch)
tree08fce2140c4f06ff363a1e6a42c8d6eb3230c1a4
parentaa3b0f23dccfb8c8e52fc6f27fb7b99bad42a0b5 (diff)
downloadpykolab-7566d1439506543bdf885a3350e4363dde109fdd.tar.gz
Fix varname and avoid throwing an execption on every call
-rw-r--r--pykolab/xml/event.py16
1 files changed, 2 insertions, 14 deletions
diff --git a/pykolab/xml/event.py b/pykolab/xml/event.py
index 5080e43..e2e5440 100644
--- a/pykolab/xml/event.py
+++ b/pykolab/xml/event.py
@@ -12,6 +12,7 @@ from pykolab import constants
from pykolab import utils
from pykolab.xml import utils as xmlutils
from pykolab.xml import participant_status_label
+from pykolab.xml.utils import ustr
from pykolab.translate import _
from os import path
@@ -21,19 +22,6 @@ from recurrence_rule import RecurrenceRule
log = pykolab.getLogger('pykolab.xml_event')
-def ustr(s):
- if not isinstance(s, unicode):
- for cs in ['utf-8','latin-1']:
- try:
- s = unicode(s, cs)
- break
- except:
- pass
-
- if isinstance(s, unicode):
- return s.encode('utf-8')
-
- return s
def event_from_ical(ical, string=None):
return Event(from_ical=ical, from_string=string)
@@ -680,7 +668,7 @@ class Event(object):
def get_lastmodified(self):
try:
_datetime = self.event.lastModified()
- if retval == None or retval == "":
+ if _datetime == None or not _datetime.isValid():
self.__str__()
except:
self.__str__()