hooks/metadata.py
branchstable
changeset 5066 bf5cbc351e99
parent 4835 13b0b96d7982
child 5174 78438ad513ca
child 5421 8167de96c523
--- a/hooks/metadata.py	Tue Mar 30 10:20:03 2010 +0200
+++ b/hooks/metadata.py	Tue Mar 30 10:28:41 2010 +0200
@@ -12,17 +12,7 @@
 
 from cubicweb.selectors import implements
 from cubicweb.server import hook
-
-
-def eschema_eid(session, eschema):
-    """get eid of the CWEType entity for the given yams type"""
-    # eschema.eid is None if schema has been readen from the filesystem, not
-    # from the database (eg during tests)
-    if eschema.eid is None:
-        eschema.eid = session.execute(
-            'Any X WHERE X is CWEType, X name %(name)s',
-            {'name': str(eschema)})[0][0]
-    return eschema.eid
+from cubicweb.server.utils import eschema_eid
 
 
 class MetaDataHook(hook.Hook):