--- a/selectors.py Thu Aug 13 11:32:34 2009 +0200
+++ b/selectors.py Thu Aug 13 11:49:56 2009 +0200
@@ -960,83 +960,3 @@
def __init__(self, scorefunc, once_is_enough=False):
super(score_entity, self).__init__(once_is_enough)
self.score_entity = scorefunc
-
-
-def unbind_method(selector):
- def new_selector(registered):
- # get the unbound method
- if hasattr(registered, 'im_func'):
- registered = registered.im_func
- # don't rebind since it will be done automatically during
- # the assignment, inside the destination class body
- return selector(registered)
- new_selector.__name__ = selector.__name__
- return new_selector
-
-
-def deprecate(registered, msg):
- # get the unbound method
- if hasattr(registered, 'im_func'):
- registered = registered.im_func
- def _deprecate(cls, vreg):
- warn(msg, DeprecationWarning)
- return registered(cls, vreg)
- return _deprecate
-
-@unbind_method
-def require_group_compat(registered):
- def plug_selector(cls, vreg):
- cls = registered(cls, vreg)
- if getattr(cls, 'require_groups', None):
- warn('use "match_user_groups(group1, group2)" instead of using require_groups',
- DeprecationWarning)
- cls.__select__ &= match_user_groups(cls.require_groups)
- return cls
- return plug_selector
-
-@unbind_method
-def accepts_compat(registered):
- def plug_selector(cls, vreg):
- cls = registered(cls, vreg)
- if getattr(cls, 'accepts', None):
- warn('use "implements("EntityType", IFace)" instead of using accepts on %s'
- % cls,
- DeprecationWarning)
- cls.__select__ &= implements(*cls.accepts)
- return cls
- return plug_selector
-
-@unbind_method
-def accepts_etype_compat(registered):
- def plug_selector(cls, vreg):
- cls = registered(cls, vreg)
- if getattr(cls, 'accepts', None):
- warn('use "specified_etype_implements("EntityType", IFace)" instead of using accepts',
- DeprecationWarning)
- cls.__select__ &= specified_etype_implements(*cls.accepts)
- return cls
- return plug_selector
-
-@unbind_method
-def condition_compat(registered):
- def plug_selector(cls, vreg):
- cls = registered(cls, vreg)
- if getattr(cls, 'condition', None):
- warn('use "use rql_condition(expression)" instead of using condition',
- DeprecationWarning)
- cls.__select__ &= 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, 'etype', None):
- warn('use relation_possible selector instead of using etype_rtype',
- DeprecationWarning)
- cls.__select__ &= relation_possible(cls.rtype, role(cls),
- getattr(cls, 'etype', None),
- action=getattr(cls, 'require_permission', 'read'))
- return cls
- return plug_selector