# HG changeset patch # User Sylvain Thénault # Date 1260358865 -3600 # Node ID e710f4052bd629ac7f5f234064fa40fc8c8e8d37 # Parent 9cce43f52c61ca195e2be7062903c7dae6071084 use implements instead of entity_implements diff -r 9cce43f52c61 -r e710f4052bd6 hooks/integrity.py --- a/hooks/integrity.py Wed Dec 09 12:24:38 2009 +0100 +++ b/hooks/integrity.py Wed Dec 09 12:41:05 2009 +0100 @@ -10,7 +10,7 @@ from cubicweb import ValidationError from cubicweb.schema import RQLConstraint, RQLUniqueConstraint -from cubicweb.selectors import entity_implements +from cubicweb.selectors import implements from cubicweb.uilib import soup2xhtml from cubicweb.server import hook @@ -237,7 +237,7 @@ """delete the composed of a composite relation when this relation is deleted """ __regid__ = 'checkownersgroup' - __select__ = IntegrityHook.__select__ & entity_implements('CWGroup') + __select__ = IntegrityHook.__select__ & implements('CWGroup') events = ('before_delete_entity', 'before_update_entity') def __call__(self): @@ -273,7 +273,7 @@ class StripCWUserLoginHook(IntegrityHook): """ensure user logins are stripped""" __regid__ = 'stripuserlogin' - __select__ = IntegrityHook.__select__ & entity_implements('CWUser') + __select__ = IntegrityHook.__select__ & implements('CWUser') events = ('before_add_entity', 'before_update_entity',) def __call__(self): diff -r 9cce43f52c61 -r e710f4052bd6 hooks/metadata.py --- a/hooks/metadata.py Wed Dec 09 12:24:38 2009 +0100 +++ b/hooks/metadata.py Wed Dec 09 12:41:05 2009 +0100 @@ -10,7 +10,7 @@ from datetime import datetime -from cubicweb.selectors import entity_implements +from cubicweb.selectors import implements from cubicweb.server import hook from cubicweb.server.repository import FTIndexEntityOp @@ -136,7 +136,7 @@ class FixUserOwnershipHook(MetaDataHook): """when a user has been created, add owned_by relation on itself""" __regid__ = 'fixuserowner' - __select__ = MetaDataHook.__select__ & entity_implements('CWUser') + __select__ = MetaDataHook.__select__ & implements('CWUser') events = ('after_add_entity',) def __call__(self): diff -r 9cce43f52c61 -r e710f4052bd6 hooks/notification.py --- a/hooks/notification.py Wed Dec 09 12:24:38 2009 +0100 +++ b/hooks/notification.py Wed Dec 09 12:41:05 2009 +0100 @@ -10,7 +10,7 @@ from logilab.common.textutils import normalize_text from cubicweb import RegistryException -from cubicweb.selectors import entity_implements +from cubicweb.selectors import implements from cubicweb.server import hook from cubicweb.sobjects.supervising import SupervisionMailOp @@ -37,7 +37,7 @@ class StatusChangeHook(NotificationHook): """notify when a workflowable entity has its state modified""" __regid__ = 'notifystatuschange' - __select__ = NotificationHook.__select__ & entity_implements('TrInfo') + __select__ = NotificationHook.__select__ & implements('TrInfo') events = ('after_add_entity',) def __call__(self): diff -r 9cce43f52c61 -r e710f4052bd6 hooks/syncschema.py --- a/hooks/syncschema.py Wed Dec 09 12:24:38 2009 +0100 +++ b/hooks/syncschema.py Wed Dec 09 12:41:05 2009 +0100 @@ -19,7 +19,7 @@ from logilab.common.decorators import clear_cache from cubicweb import ValidationError, RepositoryError -from cubicweb.selectors import entity_implements +from cubicweb.selectors import implements from cubicweb.schema import META_RTYPES, VIRTUAL_RTYPES, CONSTRAINTS from cubicweb.server import hook, schemaserial as ss from cubicweb.server.sqlutils import SQL_PREFIX @@ -765,7 +765,7 @@ * instantiate an operation to delete the entity type on commit """ __regid__ = 'syncdelcwetype' - __select__ = SyncSchemaHook.__select__ & entity_implements('CWEType') + __select__ = SyncSchemaHook.__select__ & implements('CWEType') events = ('before_delete_entity',) def __call__(self): @@ -866,7 +866,7 @@ * instantiate an operation to delete the relation type on commit """ __regid__ = 'syncdelcwrtype' - __select__ = SyncSchemaHook.__select__ & entity_implements('CWRType') + __select__ = SyncSchemaHook.__select__ & implements('CWRType') events = ('before_delete_entity',) def __call__(self): @@ -999,7 +999,7 @@ class AfterAddCWAttributeHook(SyncSchemaHook): __regid__ = 'syncaddcwattribute' - __select__ = SyncSchemaHook.__select__ & entity_implements('CWAttribute') + __select__ = SyncSchemaHook.__select__ & implements('CWAttribute') events = ('after_add_entity',) def __call__(self): @@ -1008,7 +1008,7 @@ class AfterAddCWRelationHook(AfterAddCWAttributeHook): __regid__ = 'syncaddcwrelation' - __select__ = SyncSchemaHook.__select__ & entity_implements('CWRelation') + __select__ = SyncSchemaHook.__select__ & implements('CWRelation') def __call__(self): SourceDbCWRelationAdd(self._cw, entity=self.entity) @@ -1016,7 +1016,7 @@ class AfterUpdateCWRDefHook(SyncSchemaHook): __regid__ = 'syncaddcwattribute' - __select__ = SyncSchemaHook.__select__ & entity_implements('CWAttribute', + __select__ = SyncSchemaHook.__select__ & implements('CWAttribute', 'CWRelation') events = ('after_update_entity',) @@ -1046,7 +1046,7 @@ class AfterAddCWConstraintHook(SyncSchemaHook): __regid__ = 'syncaddcwconstraint' - __select__ = SyncSchemaHook.__select__ & entity_implements('CWConstraint') + __select__ = SyncSchemaHook.__select__ & implements('CWConstraint') events = ('after_add_entity', 'after_update_entity') def __call__(self): diff -r 9cce43f52c61 -r e710f4052bd6 hooks/syncsession.py --- a/hooks/syncsession.py Wed Dec 09 12:24:38 2009 +0100 +++ b/hooks/syncsession.py Wed Dec 09 12:41:05 2009 +0100 @@ -8,7 +8,7 @@ __docformat__ = "restructuredtext en" from cubicweb import UnknownProperty, ValidationError, BadConnectionId -from cubicweb.selectors import entity_implements +from cubicweb.selectors import implements from cubicweb.server import hook @@ -94,7 +94,7 @@ class CloseDeletedUserSessionsHook(SyncSessionHook): __regid__ = 'closession' - __select__ = SyncSessionHook.__select__ & entity_implements('CWUser') + __select__ = SyncSessionHook.__select__ & implements('CWUser') events = ('after_delete_entity',) def __call__(self): @@ -138,7 +138,7 @@ class AddCWPropertyHook(SyncSessionHook): __regid__ = 'addcwprop' - __select__ = SyncSessionHook.__select__ & entity_implements('CWProperty') + __select__ = SyncSessionHook.__select__ & implements('CWProperty') events = ('after_add_entity',) def __call__(self): diff -r 9cce43f52c61 -r e710f4052bd6 hooks/workflow.py --- a/hooks/workflow.py Wed Dec 09 12:24:38 2009 +0100 +++ b/hooks/workflow.py Wed Dec 09 12:41:05 2009 +0100 @@ -11,7 +11,7 @@ from cubicweb import RepositoryError, ValidationError from cubicweb.interfaces import IWorkflowable -from cubicweb.selectors import entity_implements +from cubicweb.selectors import implements from cubicweb.server import hook from cubicweb.entities.wfobjs import WorkflowTransition @@ -143,7 +143,7 @@ class SetInitialStateHook(WorkflowHook): __regid__ = 'wfsetinitial' - __select__ = WorkflowHook.__select__ & entity_implements(IWorkflowable) + __select__ = WorkflowHook.__select__ & implements(IWorkflowable) events = ('after_add_entity',) def __call__(self): @@ -167,7 +167,7 @@ * by_transition or to_state (managers only) inlined relation is set """ __regid__ = 'wffiretransition' - __select__ = WorkflowHook.__select__ & entity_implements('TrInfo') + __select__ = WorkflowHook.__select__ & implements('TrInfo') events = ('before_add_entity',) def __call__(self): @@ -254,7 +254,7 @@ class FiredTransitionHook(WorkflowHook): """change related entity state""" __regid__ = 'wffiretransition' - __select__ = WorkflowHook.__select__ & entity_implements('TrInfo') + __select__ = WorkflowHook.__select__ & implements('TrInfo') events = ('after_add_entity',) def __call__(self): diff -r 9cce43f52c61 -r e710f4052bd6 server/hook.py --- a/server/hook.py Wed Dec 09 12:24:38 2009 +0100 +++ b/server/hook.py Wed Dec 09 12:41:05 2009 +0100 @@ -45,7 +45,7 @@ from cubicweb.cwvreg import CWRegistry, VRegistry from cubicweb.selectors import (objectify_selector, lltrace, match_search_state, - entity_implements) + implements) from cubicweb.appobject import AppObject @@ -186,7 +186,7 @@ if ertype.islower(): rtypes.append(ertype) else: - cls.__select__ = cls.__select__ & entity_implements(ertype) + cls.__select__ = cls.__select__ & implements(ertype) if rtypes: cls.__select__ = cls.__select__ & match_rtype(*rtypes) return cls diff -r 9cce43f52c61 -r e710f4052bd6 web/views/formrenderers.py --- a/web/views/formrenderers.py Wed Dec 09 12:24:38 2009 +0100 +++ b/web/views/formrenderers.py Wed Dec 09 12:41:05 2009 +0100 @@ -16,7 +16,7 @@ from cubicweb import tags from cubicweb.appobject import AppObject -from cubicweb.selectors import entity_implements, yes +from cubicweb.selectors import implements, yes from cubicweb.web import eid_param, formwidgets as fwdgs @@ -348,7 +348,7 @@ """specific renderer for entity edition form (edition)""" __regid__ = 'default' # needs some additional points in some case (XXX explain cases) - __select__ = entity_implements('Any') & yes() + __select__ = implements('Any') & yes() _options = FormRenderer._options + ('display_relations_form', 'main_form_title') display_relations_form = True diff -r 9cce43f52c61 -r e710f4052bd6 web/views/workflow.py --- a/web/views/workflow.py Wed Dec 09 12:24:38 2009 +0100 +++ b/web/views/workflow.py Wed Dec 09 12:41:05 2009 +0100 @@ -17,7 +17,7 @@ from cubicweb import Unauthorized, view from cubicweb.selectors import (implements, has_related_entities, one_line_rset, relation_possible, match_form_params, - entity_implements, score_entity) + implements, score_entity) from cubicweb.interfaces import IWorkflowable from cubicweb.view import EntityView from cubicweb.schema import display_name @@ -80,7 +80,7 @@ def get_form(self, entity, transition, **kwargs): # XXX used to specify both rset/row/col and entity in case implements - # selector (and not entity_implements) is used on custom form + # selector (and not implements) is used on custom form form = self._cw.vreg['forms'].select( 'changestate', self._cw, entity=entity, transition=transition, redirect_path=self.redirectpath(entity), **kwargs) @@ -233,7 +233,7 @@ class TransitionEditionForm(autoform.AutomaticEntityForm): - __select__ = entity_implements('Transition') + __select__ = implements('Transition') def workflow_states_for_relation(self, targetrelation): eids = self.edited_entity.linked_to('transition_of', 'subject') @@ -254,7 +254,7 @@ class StateEditionForm(autoform.AutomaticEntityForm): - __select__ = entity_implements('State') + __select__ = implements('State') def subject_allowed_transition_vocabulary(self, rtype, limit=None): if not self.edited_entity.has_eid():