sobjects/email.py
branchtls-sprint
changeset 1802 d628defebc17
parent 1138 22f634977c95
child 1977 606923dff11b
--- a/sobjects/email.py	Thu May 14 10:24:56 2009 +0200
+++ b/sobjects/email.py	Thu May 14 11:38:40 2009 +0200
@@ -1,7 +1,7 @@
 """hooks to ensure use_email / primary_email relations consistency
 
 :organization: Logilab
-:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
 __docformat__ = "restructuredtext en"
@@ -15,50 +15,50 @@
     """
     rtype = 'use_email'
     fromeid = toeid = None # make pylint happy
-    
+
     def condition(self):
         """check entity has use_email set for the email address"""
         return not self.session.unsafe_execute(
             'Any X WHERE X eid %(x)s, X use_email Y, Y eid %(y)s',
             {'x': self.fromeid, 'y': self.toeid}, 'x')
-    
+
     def precommit_event(self):
         session = self.session
         if self.condition():
             session.unsafe_execute(
                 'SET X %s Y WHERE X eid %%(x)s, Y eid %%(y)s' % self.rtype,
                 {'x': self.fromeid, 'y': self.toeid}, 'x')
-    
+
 class SetPrimaryEmailRelationOp(SetUseEmailRelationOp):
     rtype = 'primary_email'
-    
+
     def condition(self):
         """check entity has no primary_email set"""
         return not self.session.unsafe_execute(
             'Any X WHERE X eid %(x)s, X primary_email Y',
             {'x': self.fromeid}, 'x')
 
-    
+
 class SetPrimaryEmailHook(Hook):
     """notify when a bug or story or version has its state modified"""
     events = ('after_add_relation',)
     accepts = ('use_email',)
-    
+
     def call(self, session, fromeid, rtype, toeid):
         subjtype = session.describe(fromeid)[0]
         eschema = self.vreg.schema[subjtype]
         if 'primary_email' in eschema.subject_relations():
-            SetPrimaryEmailRelationOp(session, vreg=self.vreg, 
+            SetPrimaryEmailRelationOp(session, vreg=self.vreg,
                                       fromeid=fromeid, toeid=toeid)
 
 class SetUseEmailHook(Hook):
     """notify when a bug or story or version has its state modified"""
     events = ('after_add_relation',)
     accepts = ('primary_email',)
-    
+
     def call(self, session, fromeid, rtype, toeid):
         subjtype = session.describe(fromeid)[0]
         eschema = self.vreg.schema[subjtype]
         if 'use_email' in eschema.subject_relations():
-            SetUseEmailRelationOp(session, vreg=self.vreg, 
+            SetUseEmailRelationOp(session, vreg=self.vreg,
                                   fromeid=fromeid, toeid=toeid)