[conduit/tracker] Use dateutil.parser to get a useful datetime object out of tracker
- From: John Carr <johncarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [conduit/tracker] Use dateutil.parser to get a useful datetime object out of tracker
- Date: Fri, 19 Jun 2009 19:24:43 -0400 (EDT)
commit 74a89f5d1c06e6fe973d21405e0d0c12353cad8c
Author: John Carr <john carr unrouted co uk>
Date: Tue Jun 16 18:30:50 2009 +0100
Use dateutil.parser to get a useful datetime object out of tracker
conduit/modules/TrackerModule/tralchemy/core.py | 6 ++++--
.../modules/TrackerModule/tralchemy/namespace.py | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/conduit/modules/TrackerModule/tralchemy/core.py b/conduit/modules/TrackerModule/tralchemy/core.py
index cbca3fd..b89f0dd 100644
--- a/conduit/modules/TrackerModule/tralchemy/core.py
+++ b/conduit/modules/TrackerModule/tralchemy/core.py
@@ -2,6 +2,8 @@
import dbus
import uuid
+import dateutil.parser
+
bus = dbus.SessionBus()
tracker_obj = bus.get_object("org.freedesktop.Tracker", "/org/freedesktop/Tracker/Resources")
tracker = dbus.Interface(tracker_obj, "org.freedesktop.Tracker.Resources")
@@ -180,8 +182,8 @@ class WrapperFactory(object):
self.wrapped["xsd:double"] = float
self.wrapped["rdfs:Literal"] = str
self.wrapped["xsd:string"] = str
- self.wrapped['xsd:date'] = str
- self.wrapped['xsd:dateTime'] = str
+ self.wrapped['xsd:date'] = lambda x: dateutil.parser.parser().parse(x)
+ self.wrapped['xsd:dateTime'] = lambda x: dateutil.parser.parser().parse(x)
def get_class(self, classname):
classname = get_classname(classname)
diff --git a/conduit/modules/TrackerModule/tralchemy/namespace.py b/conduit/modules/TrackerModule/tralchemy/namespace.py
index 50e07b4..7082d2f 100644
--- a/conduit/modules/TrackerModule/tralchemy/namespace.py
+++ b/conduit/modules/TrackerModule/tralchemy/namespace.py
@@ -54,7 +54,7 @@ class Importer(object):
if not "tralchemy." in name:
return None
name = name[name.find("tralchemy.")+10:]
- if name in ('namespace', 'core', 'dbus', 'uuid', 'sys'):
+ if name in ('namespace', 'core', 'dbus', 'uuid', 'sys', 'dateutil'):
return None
if '.' in name:
return None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]