server/sources/__init__.py
changeset 1251 af40e615dc89
parent 1250 5c20a7f13c84
child 1263 01152fffd593
--- a/server/sources/__init__.py	Mon Apr 06 16:11:38 2009 +0200
+++ b/server/sources/__init__.py	Mon Apr 06 16:18:46 2009 +0200
@@ -11,6 +11,8 @@
 from mx.DateTime import now, DateTimeDelta
 
 from cubicweb import set_log_methods
+from cubicweb.server.sqlutils import SQL_PREFIX
+
 
 class TimedCache(dict):
     def __init__(self, ttlm, ttls=0):
@@ -78,7 +80,7 @@
         pass
     
     def __repr__(self):
-        return '<%s source>' % self.uri
+        return '<%s source @%#x>' % (self.uri, id(self))
 
     def __cmp__(self, other):
         """simple comparison function to get predictable source order, with the
@@ -159,15 +161,18 @@
         if not myeids:
             return
         # delete relations referencing one of those eids
+        eidcolum = SQL_PREFIX + 'eid'
         for rschema in self.schema.relations():
             if rschema.is_final() or rschema.type == 'identity':
                 continue
             if rschema.inlined:
+                column = SQL_PREFIX + rschema.type
                 for subjtype in rschema.subjects():
+                    table = SQL_PREFIX + str(subjtype)
                     for objtype in rschema.objects(subjtype):
                         if self.support_entity(objtype):
-                            sql = 'UPDATE %s SET %s = NULL WHERE eid IN (%s);' % (
-                                subjtype, rschema.type, myeids)
+                            sql = 'UPDATE %s SET %s=NULL WHERE %s IN (%s);' % (
+                                table, column, eidcolum, myeids)
                             session.system_sql(sql)
                             break
                 continue