utils.py
branchstable
changeset 2361 8f00836580f1
parent 2332 b04d80f19075
child 2554 3b6a6d2f9d7e
--- a/utils.py	Thu Jul 09 16:44:34 2009 +0200
+++ b/utils.py	Thu Jul 09 17:16:49 2009 +0200
@@ -326,6 +326,14 @@
     """
     # XXX deprecated, no more necessary
 
+def get_schema_property(eschema, rschema, role, property):
+    # XXX use entity.e_schema.role_rproperty(role, rschema, property, tschemas[0]) once yams > 0.23.0 is out
+    if role == 'subject':
+        targetschema = rschema.objects(eschema)[0]
+        return rschema.rproperty(eschema, targetschema, property)
+    targetschema = rschema.subjects(eschema)[0]
+    return rschema.rproperty(targetschema, eschema, property)
+
 def compute_cardinality(eschema, rschema, role):
     if role == 'subject':
         targetschema = rschema.objects(eschema)[0]
@@ -333,4 +341,3 @@
     targetschema = rschema.subjects(eschema)[0]
     return rschema.rproperty(targetschema, eschema, 'cardinality')[1]
 
-