cwvreg.py
branchstable
changeset 7302 c281afe35b8b
parent 7206 2723c52a0795
child 7304 66fa1b7ac784
child 7465 bb0c89d1a078
--- a/cwvreg.py	Tue May 03 11:02:32 2011 +0200
+++ b/cwvreg.py	Wed May 04 10:32:15 2011 +0200
@@ -373,6 +373,16 @@
         cls.__initialize__(self.schema)
         return cls
 
+    def fetch_attrs(self, targettypes):
+        """return intersection of fetch_attrs of each entity type in
+        `targettypes`
+        """
+        fetchattrs_list = []
+        for ttype in targettypes:
+            etypecls = self.etype_class(ttype)
+            fetchattrs_list.append(set(etypecls.fetch_attrs))
+        return reduce(set.intersection, fetchattrs_list)
+
 VRegistry.REGISTRY_FACTORY['etypes'] = ETypeRegistry