--- a/server/sources/native.py Mon Mar 09 12:12:53 2009 +0100
+++ b/server/sources/native.py Tue Mar 10 11:35:52 2009 +0100
@@ -1,14 +1,13 @@
"""Adapters for native cubicweb sources.
:organization: Logilab
-:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__ = "restructuredtext en"
from threading import Lock
-
-from mx.DateTime import now
+from datetime import datetime
from logilab.common.cache import Cache
from logilab.common.configuration import REQUIRED
@@ -451,7 +450,7 @@
try:
res = session.system_sql(sql).fetchone()
except:
- assert self.pool, 'session has no pool set'
+ assert session.pool, 'session has no pool set'
raise UnknownEid(eid)
if res is None:
raise UnknownEid(eid)
@@ -499,7 +498,7 @@
"""add type and source info for an eid into the system table"""
# begin by inserting eid/type/source/extid into the entities table
attrs = {'type': str(entity.e_schema), 'eid': entity.eid,
- 'extid': extid, 'source': source.uri, 'mtime': now()}
+ 'extid': extid, 'source': source.uri, 'mtime': datetime.now()}
session.system_sql(self.sqlgen.insert('entities', attrs), attrs)
def delete_info(self, session, eid, etype, uri, extid):
@@ -510,7 +509,7 @@
session.system_sql(self.sqlgen.delete('entities', attrs), attrs)
if self.has_deleted_entitites_table:
attrs = {'type': etype, 'eid': eid, 'extid': extid,
- 'source': uri, 'dtime': now()}
+ 'source': uri, 'dtime': datetime.now()}
session.system_sql(self.sqlgen.insert('deleted_entities', attrs), attrs)
def fti_unindex_entity(self, session, eid):
@@ -534,7 +533,7 @@
if self.indexer is not None:
self.exception('error while reindexing %s', entity)
# update entities.mtime
- attrs = {'eid': entity.eid, 'mtime': now()}
+ attrs = {'eid': entity.eid, 'mtime': datetime.now()}
session.system_sql(self.sqlgen.update('entities', attrs, ['eid']), attrs)
def modified_entities(self, session, etypes, mtime):