cubicweb/server/hook.py
changeset 11765 9cb215e833b0
parent 11057 0b59724cb3f2
child 11767 432f87a63057
--- a/cubicweb/server/hook.py	Thu Oct 06 12:15:50 2016 +0200
+++ b/cubicweb/server/hook.py	Sat Oct 01 11:56:27 2016 +0200
@@ -463,10 +463,10 @@
         if kwargs.get('rtype') not in self.expected:
             return 0
         if self.frometypes is not None and \
-               req.entity_metas(kwargs['eidfrom'])['type'] not in self.frometypes:
+               req.entity_type(kwargs['eidfrom']) not in self.frometypes:
             return 0
         if self.toetypes is not None and \
-               req.entity_metas(kwargs['eidto'])['type'] not in self.toetypes:
+               req.entity_type(kwargs['eidto']) not in self.toetypes:
             return 0
         return 1
 
@@ -607,7 +607,7 @@
     def __call__(self):
         assert self.main_rtype
         for eid in (self.eidfrom, self.eidto):
-            etype = self._cw.entity_metas(eid)['type']
+            etype = self._cw.entity_type(eid)
             if self.main_rtype not in self._cw.vreg.schema.eschema(etype).subjrels:
                 return
         if self.rtype in self.subject_relations:
@@ -643,7 +643,7 @@
     skip_object_relations = ()
 
     def __call__(self):
-        eschema = self._cw.vreg.schema.eschema(self._cw.entity_metas(self.eidfrom)['type'])
+        eschema = self._cw.vreg.schema.eschema(self._cw.entity_type(self.eidfrom))
         execute = self._cw.execute
         for rel in self.subject_relations:
             if rel in eschema.subjrels and not rel in self.skip_subject_relations:
@@ -667,7 +667,7 @@
     events = ('after_delete_relation',)
 
     def __call__(self):
-        eschema = self._cw.vreg.schema.eschema(self._cw.entity_metas(self.eidfrom)['type'])
+        eschema = self._cw.vreg.schema.eschema(self._cw.entity_type(self.eidfrom))
         execute = self._cw.execute
         for rel in self.subject_relations:
             if rel in eschema.subjrels and not rel in self.skip_subject_relations: