# HG changeset patch # User Sylvain Thénault # Date 1253688172 -7200 # Node ID f5c69485381fc6bac4b73ad0f30fb7760119f8ab # Parent ebb11fa58ab9fc7216d936690fd7a77fb812b9c0 [appobjects] use __regid__ instead of __id__, more explicit diff -r ebb11fa58ab9 -r f5c69485381f appobject.py --- a/appobject.py Wed Sep 23 08:17:52 2009 +0200 +++ b/appobject.py Wed Sep 23 08:42:52 2009 +0200 @@ -208,7 +208,7 @@ :__registry__: name of the registry for this object (string like 'views', 'templates'...) - :__id__: + :__regid__: object's identifier in the registry (string like 'main', 'primary', 'folder_box') :__select__: @@ -239,7 +239,7 @@ are interested in, else None """ __registry__ = None - __id__ = None + __regid__ = None __select__ = yes() @classmethod diff -r ebb11fa58ab9 -r f5c69485381f cwvreg.py --- a/cwvreg.py Wed Sep 23 08:17:52 2009 +0200 +++ b/cwvreg.py Wed Sep 23 08:42:52 2009 +0200 @@ -161,11 +161,11 @@ objects = self['Any'] assert len(objects) == 1, objects cls = objects[0] - # make a copy event if cls.__id__ == etype, else we may have pb for + # make a copy event if cls.__regid__ == etype, else we may have pb for # client application using multiple connections to different # repositories (eg shingouz) cls = dump_class(cls, etype) - cls.__id__ = etype + cls.__regid__ = etype cls.__initialize__(self.schema) return cls diff -r ebb11fa58ab9 -r f5c69485381f entity.py --- a/entity.py Wed Sep 23 08:17:52 2009 +0200 +++ b/entity.py Wed Sep 23 08:42:52 2009 +0200 @@ -78,7 +78,7 @@ """initialize a specific entity class by adding descriptors to access entity type's attributes and relations """ - etype = cls.__id__ + etype = cls.__regid__ assert etype != 'Any', etype cls.e_schema = eschema = schema.eschema(etype) for rschema, _ in eschema.attribute_definitions(): @@ -109,7 +109,7 @@ """return a rql to fetch all entities of the class type""" restrictions = restriction or [] if settype: - restrictions.append('%s is %s' % (mainvar, cls.__id__)) + restrictions.append('%s is %s' % (mainvar, cls.__regid__)) if fetchattrs is None: fetchattrs = cls.fetch_attrs selection = [mainvar] @@ -142,7 +142,7 @@ rschema = eschema.subject_relation(attr) except KeyError: cls.warning('skipping fetch_attr %s defined in %s (not found in schema)', - attr, cls.__id__) + attr, cls.__regid__) continue if not user.matching_groups(rschema.get_groups('read')): continue @@ -285,7 +285,7 @@ kwargs['_restpath'] = self.rest_path(kwargs.get('base_url')) except TypeError: warn('%s: rest_path() now take use_ext_eid argument, ' - 'please update' % self.__id__, DeprecationWarning) + 'please update' % self.__regid__, DeprecationWarning) kwargs['_restpath'] = self.rest_path() else: kwargs['rql'] = 'Any X WHERE X eid %s' % self.eid @@ -421,7 +421,7 @@ def as_rset(self): """returns a resultset containing `self` information""" rset = ResultSet([(self.eid,)], 'Any X WHERE X eid %(x)s', - {'x': self.eid}, [(self.__id__,)]) + {'x': self.eid}, [(self.__regid__,)]) return self.req.decorate_rset(rset) def to_complete_relations(self): diff -r ebb11fa58ab9 -r f5c69485381f hooks/bookmark.py --- a/hooks/bookmark.py Wed Sep 23 08:17:52 2009 +0200 +++ b/hooks/bookmark.py Wed Sep 23 08:42:52 2009 +0200 @@ -21,7 +21,7 @@ class DelBookmarkedByHook(hook.Hook): """ensure user logins are stripped""" - __id__ = 'autodelbookmark' + __regid__ = 'autodelbookmark' __select__ = hook.Hook.__select__ & entity_implements('bookmarked_by',) category = 'bookmark' events = ('after_delete_relation',) diff -r ebb11fa58ab9 -r f5c69485381f hooks/email.py --- a/hooks/email.py Wed Sep 23 08:17:52 2009 +0200 +++ b/hooks/email.py Wed Sep 23 08:42:52 2009 +0200 @@ -43,7 +43,7 @@ class SetPrimaryEmailHook(hook.Hook): """notify when a bug or story or version has its state modified""" - __id__ = 'setprimaryemail' + __regid__ = 'setprimaryemail' __select__ = hook.Hook.__select__ & hook.match_rtype('use_email') category = 'email' events = ('after_add_relation',) @@ -56,7 +56,7 @@ class SetUseEmailHook(hook.Hook): """notify when a bug or story or version has its state modified""" - __id__ = 'setprimaryemail' + __regid__ = 'setprimaryemail' __select__ = hook.Hook.__select__ & hook.match_rtype('primary_email') category = 'email' events = ('after_add_relation',) diff -r ebb11fa58ab9 -r f5c69485381f hooks/integrity.py --- a/hooks/integrity.py Wed Sep 23 08:17:52 2009 +0200 +++ b/hooks/integrity.py Wed Sep 23 08:42:52 2009 +0200 @@ -65,7 +65,7 @@ class CheckCardinalityHook(IntegrityHook): """check cardinalities are satisfied""" - __id__ = 'checkcard' + __regid__ = 'checkcard' events = ('after_add_entity', 'before_delete_relation') def __call__(self): @@ -144,7 +144,7 @@ this is delayed to a precommit time operation since other relation which will make constraint satisfied may be added later. """ - __id__ = 'checkconstraint' + __regid__ = 'checkconstraint' events = ('after_add_relation',) def __call__(self): @@ -156,7 +156,7 @@ class CheckUniqueHook(IntegrityHook): - __id__ = 'checkunique' + __regid__ = 'checkunique' events = ('before_add_entity', 'before_update_entity') def __call__(self): @@ -194,7 +194,7 @@ class DeleteCompositeOrphanHook(IntegrityHook): """delete the composed of a composite relation when this relation is deleted """ - __id__ = 'deletecomposite' + __regid__ = 'deletecomposite' events = ('before_delete_relation',) def __call__(self): @@ -211,7 +211,7 @@ class DontRemoveOwnersGroupHook(IntegrityHook): """delete the composed of a composite relation when this relation is deleted """ - __id__ = 'checkownersgroup' + __regid__ = 'checkownersgroup' __select__ = IntegrityHook.__select__ & entity_implements('CWGroup') events = ('before_delete_entity', 'before_update_entity') @@ -228,7 +228,7 @@ class TidyHtmlFields(IntegrityHook): """tidy HTML in rich text strings""" - __id__ = 'htmltidy' + __regid__ = 'htmltidy' events = ('before_add_entity', 'before_update_entity') def __call__(self): @@ -247,7 +247,7 @@ class StripCWUserLoginHook(IntegrityHook): """ensure user logins are stripped""" - __id__ = 'stripuserlogin' + __regid__ = 'stripuserlogin' __select__ = IntegrityHook.__select__ & entity_implements('CWUser') events = ('before_add_entity', 'before_update_entity',) diff -r ebb11fa58ab9 -r f5c69485381f hooks/metadata.py --- a/hooks/metadata.py Wed Sep 23 08:17:52 2009 +0200 +++ b/hooks/metadata.py Wed Sep 23 08:42:52 2009 +0200 @@ -37,7 +37,7 @@ this is a conveniency hook, you shouldn't have to disable it """ - __id__ = 'metaattrsinit' + __regid__ = 'metaattrsinit' events = ('before_add_entity',) def __call__(self): @@ -51,7 +51,7 @@ class UpdateMetaAttrsHook(MetaDataHook): """update an entity -> set modification date""" - __id__ = 'metaattrsupdate' + __regid__ = 'metaattrsupdate' events = ('before_update_entity',) def __call__(self): @@ -71,7 +71,7 @@ class SetIsHook(MetaDataHook): """create a new entity -> set is relation""" - __id__ = 'setis' + __regid__ = 'setis' events = ('after_add_entity',) def __call__(self): @@ -92,7 +92,7 @@ class SetOwnershipHook(MetaDataHook): """create a new entity -> set owner and creator metadata""" - __id__ = 'setowner' + __regid__ = 'setowner' events = ('after_add_entity',) def __call__(self): @@ -114,7 +114,7 @@ """when adding composite relation, the composed should have the same owners has the composite """ - __id__ = 'synccompositeowner' + __regid__ = 'synccompositeowner' events = ('after_add_relation',) def __call__(self): @@ -131,7 +131,7 @@ class FixUserOwnershipHook(MetaDataHook): """when a user has been created, add owned_by relation on itself""" - __id__ = 'fixuserowner' + __regid__ = 'fixuserowner' __select__ = MetaDataHook.__select__ & entity_implements('CWUser') events = ('after_add_entity',) @@ -142,7 +142,7 @@ class UpdateFTIHook(MetaDataHook): """sync fulltext index when relevant relation is added / removed """ - __id__ = 'updateftirel' + __regid__ = 'updateftirel' events = ('after_add_relation', 'after_delete_relation') def __call__(self): diff -r ebb11fa58ab9 -r f5c69485381f hooks/notification.py --- a/hooks/notification.py Wed Sep 23 08:17:52 2009 +0200 +++ b/hooks/notification.py Wed Sep 23 08:42:52 2009 +0200 @@ -36,7 +36,7 @@ class StatusChangeHook(NotificationHook): """notify when a workflowable entity has its state modified""" - __id__ = 'notifystatuschange' + __regid__ = 'notifystatuschange' __select__ = NotificationHook.__select__ & entity_implements('TrInfo') events = ('after_add_entity',) @@ -59,7 +59,7 @@ class RelationChangeHook(NotificationHook): - __id__ = 'notifyrelationchange' + __regid__ = 'notifyrelationchange' events = ('before_add_relation', 'after_add_relation', 'before_delete_relation', 'after_delete_relation') @@ -79,7 +79,7 @@ """if a notification view is defined for the event, send notification email defined by the view """ - __id__ = 'notifyentitychange' + __regid__ = 'notifyentitychange' events = ('after_add_entity', 'after_update_entity') def __call__(self): @@ -93,7 +93,7 @@ # supervising ################################################################## class SomethingChangedHook(NotificationHook): - __id__ = 'supervising' + __regid__ = 'supervising' events = ('before_add_relation', 'before_delete_relation', 'after_add_entity', 'before_update_entity') @@ -124,7 +124,7 @@ class EntityDeleteHook(SomethingChangedHook): - __id__ = 'supervisingentitydel' + __regid__ = 'supervisingentitydel' events = ('before_delete_entity',) def _call(self): diff -r ebb11fa58ab9 -r f5c69485381f hooks/security.py --- a/hooks/security.py Wed Sep 23 08:17:52 2009 +0200 +++ b/hooks/security.py Wed Sep 23 08:42:52 2009 +0200 @@ -56,7 +56,7 @@ class AfterAddEntitySecurityHook(SecurityHook): - __id__ = 'securityafteraddentity' + __regid__ = 'securityafteraddentity' events = ('after_add_entity',) def __call__(self): @@ -64,7 +64,7 @@ class AfterUpdateEntitySecurityHook(SecurityHook): - __id__ = 'securityafterupdateentity' + __regid__ = 'securityafterupdateentity' events = ('after_update_entity',) def __call__(self): @@ -78,7 +78,7 @@ class BeforeDelEntitySecurityHook(SecurityHook): - __id__ = 'securitybeforedelentity' + __regid__ = 'securitybeforedelentity' events = ('before_delete_entity',) def __call__(self): @@ -86,7 +86,7 @@ class BeforeAddRelationSecurityHook(SecurityHook): - __id__ = 'securitybeforeaddrelation' + __regid__ = 'securitybeforeaddrelation' events = ('before_add_relation',) def __call__(self): @@ -99,7 +99,7 @@ class AfterAddRelationSecurityHook(SecurityHook): - __id__ = 'securityafteraddrelation' + __regid__ = 'securityafteraddrelation' events = ('after_add_relation',) def __call__(self): @@ -118,7 +118,7 @@ class BeforeDelRelationSecurityHook(SecurityHook): - __id__ = 'securitybeforedelrelation' + __regid__ = 'securitybeforedelrelation' events = ('before_delete_relation',) def __call__(self): diff -r ebb11fa58ab9 -r f5c69485381f hooks/syncschema.py --- a/hooks/syncschema.py Wed Sep 23 08:17:52 2009 +0200 +++ b/hooks/syncschema.py Wed Sep 23 08:42:52 2009 +0200 @@ -763,7 +763,7 @@ * cascade to delete related CWAttribute and CWRelation entities * instantiate an operation to delete the entity type on commit """ - __id__ = 'syncdelcwetype' + __regid__ = 'syncdelcwetype' __select__ = SyncSchemaHook.__select__ & entity_implements('CWEType') events = ('before_delete_entity',) @@ -779,7 +779,7 @@ class AfterDelCWETypeHook(DelCWETypeHook): - __id__ = 'wfcleanup' + __regid__ = 'wfcleanup' events = ('after_delete_entity',) def __call__(self): @@ -796,7 +796,7 @@ * register an operation to add the entity type to the instance's schema on commit """ - __id__ = 'syncaddcwetype' + __regid__ = 'syncaddcwetype' events = ('before_add_entity',) def __call__(self): @@ -840,7 +840,7 @@ class BeforeUpdateCWETypeHook(DelCWETypeHook): """check name change, handle final""" - __id__ = 'syncupdatecwetype' + __regid__ = 'syncupdatecwetype' events = ('before_update_entity',) def __call__(self): @@ -864,7 +864,7 @@ * cascade to delete related CWAttribute and CWRelation entities * instantiate an operation to delete the relation type on commit """ - __id__ = 'syncdelcwrtype' + __regid__ = 'syncdelcwrtype' __select__ = SyncSchemaHook.__select__ & entity_implements('CWRType') events = ('before_delete_entity',) @@ -887,7 +887,7 @@ We don't know yet this point if a table is necessary """ - __id__ = 'syncaddcwrtype' + __regid__ = 'syncaddcwrtype' events = ('after_add_entity',) def __call__(self): @@ -903,7 +903,7 @@ class BeforeUpdateCWRTypeHook(DelCWRTypeHook): """check name change, handle final""" - __id__ = 'checkupdatecwrtype' + __regid__ = 'checkupdatecwrtype' events = ('before_update_entity',) def __call__(self): @@ -911,7 +911,7 @@ class AfterUpdateCWRTypeHook(DelCWRTypeHook): - __id__ = 'syncupdatecwrtype' + __regid__ = 'syncupdatecwrtype' events = ('after_update_entity',) def __call__(self): @@ -938,7 +938,7 @@ * instantiate an operation to delete the relation definition on commit * delete the associated relation type when necessary """ - __id__ = 'syncdelrelationtype' + __regid__ = 'syncdelrelationtype' __select__ = SyncSchemaHook.__select__ & hook.match_rtype('relation_type') events = ('after_delete_relation',) @@ -985,7 +985,7 @@ # CWAttribute / CWRelation hooks ############################################### class AfterAddCWAttributeHook(SyncSchemaHook): - __id__ = 'syncaddcwattribute' + __regid__ = 'syncaddcwattribute' __select__ = SyncSchemaHook.__select__ & entity_implements('CWAttribute') events = ('after_add_entity',) @@ -994,7 +994,7 @@ class AfterAddCWRelationHook(AfterAddCWAttributeHook): - __id__ = 'syncaddcwrelation' + __regid__ = 'syncaddcwrelation' __select__ = SyncSchemaHook.__select__ & entity_implements('CWRelation') def __call__(self): @@ -1002,7 +1002,7 @@ class AfterUpdateCWRDefHook(SyncSchemaHook): - __id__ = 'syncaddcwattribute' + __regid__ = 'syncaddcwattribute' __select__ = SyncSchemaHook.__select__ & entity_implements('CWAttribute', 'CWRelation') events = ('after_update_entity',) @@ -1032,7 +1032,7 @@ # constraints synchronization hooks ############################################ class AfterAddCWConstraintHook(SyncSchemaHook): - __id__ = 'syncaddcwconstraint' + __regid__ = 'syncaddcwconstraint' __select__ = SyncSchemaHook.__select__ & entity_implements('CWConstraint') events = ('after_add_entity', 'after_update_entity') @@ -1042,7 +1042,7 @@ class AfterAddConstrainedByHook(SyncSchemaHook): - __id__ = 'syncdelconstrainedby' + __regid__ = 'syncdelconstrainedby' __select__ = SyncSchemaHook.__select__ & hook.match_rtype('constrainted_by') events = ('after_add_relation',) @@ -1052,7 +1052,7 @@ class BeforeDeleteConstrainedByHook(AfterAddConstrainedByHook): - __id__ = 'syncdelconstrainedby' + __regid__ = 'syncdelconstrainedby' events = ('before_delete_relation',) def __call__(self): @@ -1077,7 +1077,7 @@ class AfterAddPermissionHook(SyncSchemaHook): """added entity/relation *_permission, need to update schema""" - __id__ = 'syncaddperm' + __regid__ = 'syncaddperm' __select__ = SyncSchemaHook.__select__ & hook.match_rtype( 'read_permission', 'add_permission', 'delete_permission', 'update_permission') @@ -1097,7 +1097,7 @@ skip the operation if the related type is being deleted """ - __id__ = 'syncdelperm' + __regid__ = 'syncdelperm' events = ('before_delete_relation',) def __call__(self): @@ -1115,7 +1115,7 @@ class AfterAddSpecializesHook(SyncSchemaHook): - __id__ = 'syncaddspecializes' + __regid__ = 'syncaddspecializes' __select__ = SyncSchemaHook.__select__ & hook.match_rtype('specializes') events = ('after_add_relation',) @@ -1125,7 +1125,7 @@ class AfterAddSpecializesHook(SyncSchemaHook): - __id__ = 'syncdelspecializes' + __regid__ = 'syncdelspecializes' __select__ = SyncSchemaHook.__select__ & hook.match_rtype('specializes') events = ('after_delete_relation',) diff -r ebb11fa58ab9 -r f5c69485381f hooks/syncsession.py --- a/hooks/syncsession.py Wed Sep 23 08:17:52 2009 +0200 +++ b/hooks/syncsession.py Wed Sep 23 08:42:52 2009 +0200 @@ -65,7 +65,7 @@ class SyncInGroupHook(SyncSessionHook): - __id__ = 'syncingroup' + __regid__ = 'syncingroup' __select__ = SyncSessionHook.__select__ & hook.match_rtype('in_group') events = ('after_delete_relation', 'after_add_relation') @@ -93,7 +93,7 @@ class CloseDeletedUserSessionsHook(SyncSessionHook): - __id__ = 'closession' + __regid__ = 'closession' __select__ = SyncSessionHook.__select__ & entity_implements('CWUser') events = ('after_delete_entity',) @@ -137,7 +137,7 @@ class AddCWPropertyHook(SyncSessionHook): - __id__ = 'addcwprop' + __regid__ = 'addcwprop' __select__ = SyncSessionHook.__select__ & entity_implements('CWProperty') events = ('after_add_entity',) @@ -159,7 +159,7 @@ class UpdateCWPropertyHook(AddCWPropertyHook): - __id__ = 'updatecwprop' + __regid__ = 'updatecwprop' events = ('after_update_entity',) def __call__(self): @@ -186,7 +186,7 @@ class DeleteCWPropertyHook(AddCWPropertyHook): - __id__ = 'delcwprop' + __regid__ = 'delcwprop' events = ('before_delete_entity',) def __call__(self): @@ -201,7 +201,7 @@ class AddForUserRelationHook(SyncSessionHook): - __id__ = 'addcwpropforuser' + __regid__ = 'addcwpropforuser' __select__ = SyncSessionHook.__select__ & hook.match_rtype('for_user') events = ('after_add_relation',) @@ -221,7 +221,7 @@ class DelForUserRelationHook(AddForUserRelationHook): - __id__ = 'delcwpropforuser' + __regid__ = 'delcwpropforuser' events = ('after_delete_relation',) def __call__(self): diff -r ebb11fa58ab9 -r f5c69485381f hooks/workflow.py --- a/hooks/workflow.py Wed Sep 23 08:17:52 2009 +0200 +++ b/hooks/workflow.py Wed Sep 23 08:42:52 2009 +0200 @@ -101,7 +101,7 @@ class SetInitialStateHook(WorkflowHook): - __id__ = 'wfsetinitial' + __regid__ = 'wfsetinitial' __select__ = WorkflowHook.__select__ & entity_implements(IWorkflowable) events = ('after_add_entity',) @@ -111,7 +111,7 @@ class PrepareStateChangeHook(WorkflowHook): """record previous state information""" - __id__ = 'cwdelstate' + __regid__ = 'cwdelstate' __select__ = WorkflowHook.__select__ & hook.match_rtype('in_state') events = ('before_delete_relation',) @@ -125,7 +125,7 @@ * wf_info_for inlined relation is set * by_transition or to_state (managers only) inlined relation is set """ - __id__ = 'wffiretransition' + __regid__ = 'wffiretransition' __select__ = WorkflowHook.__select__ & entity_implements('TrInfo') events = ('before_add_entity',) @@ -210,7 +210,7 @@ class FiredTransitionHook(WorkflowHook): """change related entity state""" - __id__ = 'wffiretransition' + __regid__ = 'wffiretransition' __select__ = WorkflowHook.__select__ & entity_implements('TrInfo') events = ('after_add_entity',) @@ -247,7 +247,7 @@ class CheckInStateChangeAllowed(WorkflowHook): """check state apply, in case of direct in_state change using unsafe_execute """ - __id__ = 'wfcheckinstate' + __regid__ = 'wfcheckinstate' __select__ = WorkflowHook.__select__ & hook.match_rtype('in_state') events = ('before_add_relation',) @@ -276,7 +276,7 @@ class SetModificationDateOnStateChange(WorkflowHook): """update entity's modification date after changing its state""" - __id__ = 'wfsyncmdate' + __regid__ = 'wfsyncmdate' __select__ = WorkflowHook.__select__ & hook.match_rtype('in_state') events = ('after_add_relation',) @@ -296,7 +296,7 @@ class CheckWorkflowTransitionExitPoint(WorkflowHook): """check that there is no multiple exits from the same state""" - __id__ = 'wfcheckwftrexit' + __regid__ = 'wfcheckwftrexit' __select__ = WorkflowHook.__select__ & hook.match_rtype('subworkflow_exit') events = ('after_add_relation',) @@ -305,7 +305,7 @@ class SetCustomWorkflow(WorkflowHook): - __id__ = 'wfsetcustom' + __regid__ = 'wfsetcustom' __select__ = WorkflowHook.__select__ & hook.match_rtype('custom_workflow') events = ('after_add_relation',) @@ -314,7 +314,7 @@ class DelCustomWorkflow(SetCustomWorkflow): - __id__ = 'wfdelcustom' + __regid__ = 'wfdelcustom' events = ('after_delete_relation',) def __call__(self): @@ -326,7 +326,7 @@ class DelWorkflowHook(WorkflowHook): - __id__ = 'wfdel' + __regid__ = 'wfdel' __select__ = WorkflowHook.__select__ & entity_implements('Workflow') events = ('after_delete_entity',) diff -r ebb11fa58ab9 -r f5c69485381f server/hook.py --- a/server/hook.py Wed Sep 23 08:17:52 2009 +0200 +++ b/server/hook.py Wed Sep 23 08:42:52 2009 +0200 @@ -136,7 +136,7 @@ enabled = True @classproperty - def __id__(cls): + def __regid__(cls): warn('[3.6] %s: please specify an id for your hook' % cls) return str(id(cls)) diff -r ebb11fa58ab9 -r f5c69485381f vregistry.py --- a/vregistry.py Wed Sep 23 08:17:52 2009 +0200 +++ b/vregistry.py Wed Sep 23 08:42:52 2009 +0200 @@ -61,11 +61,11 @@ def class_regid(cls): """returns a unique identifier for an appobject class""" if 'id' in cls.__dict__: - warn('%s: id is deprecated, use __id__') - cls.__id__ = cls.id + warn('%s: id is deprecated, use __regid__') + cls.__regid__ = cls.id if hasattr(cls, 'id'): return cls.id - return cls.__id__ + return cls.__regid__ class Registry(dict):