cleanup: eprop -> cwprop
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 18 Aug 2009 09:12:08 +0200
changeset 2898 a485d80b8fcb
parent 2896 1e7848c69be4
child 2899 3f7ce804d1e5
cleanup: eprop -> cwprop
cwvreg.py
hooks/syncsession.py
--- a/cwvreg.py	Tue Aug 18 00:29:23 2009 +0200
+++ b/cwvreg.py	Tue Aug 18 09:12:08 2009 +0200
@@ -265,7 +265,7 @@
         # definitions, and propertyvals which contains values for those
         # properties
         self['propertydefs'] = {}
-        self['propertyvalues'] = self.eprop_values = {}
+        self['propertyvalues'] = {}
         for key, propdef in self.config.eproperty_definitions():
             self.register_property(key, **propdef)
         if path is not None and force_reload:
--- a/hooks/syncsession.py	Tue Aug 18 00:29:23 2009 +0200
+++ b/hooks/syncsession.py	Tue Aug 18 09:12:08 2009 +0200
@@ -112,7 +112,7 @@
     def commit_event(self):
         """the observed connections pool has been commited"""
         try:
-            del self.epropdict[self.key]
+            del self.cwpropdict[self.key]
         except KeyError:
             self.error('%s has no associated value', self.key)
 
@@ -122,7 +122,7 @@
 
     def commit_event(self):
         """the observed connections pool has been commited"""
-        self.epropdict[self.key] = self.value
+        self.cwpropdict[self.key] = self.value
 
 
 class _AddCWPropertyOp(hook.Operation):
@@ -130,9 +130,9 @@
 
     def commit_event(self):
         """the observed connections pool has been commited"""
-        eprop = self.eprop
-        if not eprop.for_user:
-            self.repo.vreg.eprop_values[eprop.pkey] = eprop.value
+        cwprop = self.cwprop
+        if not cwprop.for_user:
+            self.repo.vreg['propertyvalues'][cwprop.pkey] = cwprop.value
         # if for_user is set, update is handled by a ChangeCWPropertyOp operation
 
 
@@ -155,7 +155,7 @@
         if not session.user.matching_groups('managers'):
             session.add_relation(entity.eid, 'for_user', session.user.eid)
         else:
-            _AddCWPropertyOp(session, eprop=entity)
+            _AddCWPropertyOp(session, cwprop=self.entity)
 
 
 class UpdateCWPropertyHook(AddCWPropertyHook):
@@ -177,11 +177,11 @@
             raise ValidationError(entity.eid, {'value': session._(str(ex))})
         if entity.for_user:
             for session_ in get_user_sessions(session.repo, entity.for_user[0].eid):
-                _ChangeCWPropertyOp(session, epropdict=session_.user.properties,
+                _ChangeCWPropertyOp(session, cwpropdict=session_.user.properties,
                                   key=key, value=value)
         else:
             # site wide properties
-            _ChangeCWPropertyOp(session, epropdict=session.vreg.eprop_values,
+            _ChangeCWPropertyOp(session, cwpropdict=session.vreg['propertyvalues'],
                               key=key, value=value)
 
 
@@ -197,7 +197,7 @@
                 # if for_user was set, delete has already been handled
                 break
         else:
-            _DelCWPropertyOp(session, epropdict=session.vreg.eprop_values, key=entity.pkey)
+            _DelCWPropertyOp(session, cwpropdict=session.vreg['propertyvalues'], key=entity.pkey)
 
 
 class AddForUserRelationHook(SyncSessionHook):
@@ -216,7 +216,7 @@
             raise ValidationError(eidfrom,
                                   {'for_user': session._("site-wide property can't be set for user")})
         for session_ in get_user_sessions(session.repo, self.eidto):
-            _ChangeCWPropertyOp(session, epropdict=session_.user.properties,
+            _ChangeCWPropertyOp(session, cwpropdict=session_.user.properties,
                               key=key, value=value)
 
 
@@ -231,4 +231,4 @@
         session.transaction_data.setdefault('pendingrelations', []).append(
             (self.eidfrom, self.rtype, self.eidto))
         for session_ in get_user_sessions(session.repo, self.eidto):
-            _DelCWPropertyOp(session, epropdict=session_.user.properties, key=key)
+            _DelCWPropertyOp(session, cwpropdict=session_.user.properties, key=key)