selectors.py
branchtls-sprint
changeset 654 36e87179e91d
parent 652 603c782dc092
child 656 3f2956c186ef
--- a/selectors.py	Tue Feb 17 12:52:50 2009 +0100
+++ b/selectors.py	Tue Feb 17 13:26:24 2009 +0100
@@ -919,7 +919,7 @@
     def plug_selector(cls, vreg):
         cls = registered(cls, vreg)
         if getattr(cls, 'require_groups', None):
-            warn('use "use match_user_groups(group1, group2)" instead of using require_groups',
+            warn('use "match_user_groups(group1, group2)" instead of using require_groups',
                  DeprecationWarning)
             cls.__selectors__ += (match_user_groups(cls.require_groups),)
         return cls
@@ -930,7 +930,7 @@
     def plug_selector(cls, vreg):
         cls = registered(cls, vreg)
         if getattr(cls, 'accepts', None):
-            warn('use "use match_user_groups(group1, group2)" instead of using require_groups',
+            warn('use "match_user_groups(group1, group2)" instead of using require_groups',
                  DeprecationWarning)
             cls.__selectors__ += (implements(*cls.accepts),)
         return cls
@@ -946,3 +946,16 @@
             cls.__selectors__ += (rql_condition(cls.condition),)
         return cls
     return plug_selector
+     
+@unbind_method
+def has_relation_compat(registered):
+    def plug_selector(cls, vreg):
+        cls = registered(cls, vreg)
+        if getattr(cls, 'type', None):
+            warn('use relation_possible selector instead of using etype_rtype',
+                 DeprecationWarning)
+            cls.__selectors__ += (relation_possible(cls.rtype), role(cls),
+                                  getattr(cls, 'etype', None),
+                                  action=getattr(cls, 'require_permission', 'read'))
+        return cls
+    return plug_selector