cwvreg.py
changeset 7304 66fa1b7ac784
parent 7272 771f594c12a2
parent 7302 c281afe35b8b
child 7423 598a4f051259
--- a/cwvreg.py	Tue May 03 17:43:53 2011 +0200
+++ b/cwvreg.py	Wed May 04 12:25:50 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