dbapi.py
changeset 7543 570522300e22
parent 7428 5338d895b891
child 7595 83872394b5d9
--- a/dbapi.py	Mon Jun 20 14:52:19 2011 +0200
+++ b/dbapi.py	Tue Jun 21 10:57:25 2011 +0200
@@ -346,9 +346,9 @@
 
     # server session compat layer #############################################
 
-    def describe(self, eid):
+    def describe(self, eid, asdict=False):
         """return a tuple (type, sourceuri, extid) for the entity with id <eid>"""
-        return self.cnx.describe(eid)
+        return self.cnx.describe(eid, asdict)
 
     def source_defs(self):
         """return the definition of sources used by the repository."""
@@ -674,8 +674,16 @@
         return self._repo.get_option_value(option, foreid)
 
     @check_not_closed
-    def describe(self, eid):
-        return self._repo.describe(self.sessionid, eid, **self._txid())
+    def describe(self, eid, asdict=False):
+        metas = self._repo.describe(self.sessionid, eid, **self._txid())
+        if asdict:
+            if len(metas) == 3:
+                d = dict(zip(('type', 'source', 'extid'), metas))
+                d['asource'] = d['source']
+                return d
+            return dict(zip(('type', 'source', 'extid', 'asource'), metas))
+        # XXX :-1 for cw compat, use asdict=True for full information
+        return metas[:-1]
 
     # db-api like interface ####################################################