def no_submitter_email(self): """True if there's no way to get email address for the submitter.""" if self.submitter_email: return 0 if self.submitter_id != str(self.acl_users._nobody): member = self.portal_membership.getMemberById(self.submitter_id) if member: email_pref = util.safeGetProperty(member, 'email', '') return not email_pref return 1
def no_submitter_email(self): """True if there's no way to get email address for the submitter.""" if self.submitter_email: return 0 if self.submitter_id != str(self.acl_users._nobody): member = self.portal_membership.getMemberById(self.submitter_id) if member: email_pref = util.safeGetProperty(member, 'email', '') return not email_pref return 1
def _set_submitter_specs(self, submitter_id, submitter_name, submitter_email): """Given an id, set the name and email as warranted.""" mbrtool = getToolByName(self, 'portal_membership') user = mbrtool.getMemberById(submitter_id) changes = [] if self.submitter_id != submitter_id: if user is None: if ((string.lower(submitter_id[:len('anonymous')]) == 'anonymous') or not submitter_id): user = self.acl_users._nobody submitter_id = str(user) else: raise ValueError, "User '%s' not found" % submitter_id changes.append("Submitter id: '%s' => '%s'" % (self.submitter_id, submitter_id)) self.submitter_id = submitter_id if not submitter_name: name = util.safeGetProperty(user, 'full_name', '') if name: submitter_name = name else: submitter_name = submitter_id if self.submitter_name != submitter_name: changes.append('submitter name') self.submitter_name = submitter_name email_pref = util.safeGetProperty(user, 'email', '') if submitter_email and submitter_email == email_pref: # A bit different than you'd expect: only stash the specified # email if it's different than the member-preference. Otherwise, # stash None, so the preference is tracked at send time. submitter_email = None if self.submitter_email != submitter_email: changes.append("submitter email") self.submitter_email = submitter_email return changes
def _set_submitter_specs(self, submitter_id, submitter_name, submitter_email): """Given an id, set the name and email as warranted.""" mbrtool = getToolByName(self, 'portal_membership') user = mbrtool.getMemberById(submitter_id) changes = [] if self.submitter_id != submitter_id: if user is None: if ((string.lower(submitter_id[:len('anonymous')]) == 'anonymous') or not submitter_id): user = self.acl_users._nobody submitter_id = str(user) else: raise ValueError, "User '%s' not found" % submitter_id changes.append("Submitter id: '%s' => '%s'" % (self.submitter_id, submitter_id)) self.submitter_id = submitter_id if not submitter_name: name = util.safeGetProperty(user, 'full_name', '') if name: submitter_name = name else: submitter_name = submitter_id if self.submitter_name != submitter_name: changes.append('submitter name') self.submitter_name = submitter_name email_pref = util.safeGetProperty(user, 'email', '') if submitter_email and submitter_email == email_pref: # A bit different than you'd expect: only stash the specified # email if it's different than the member-preference. Otherwise, # stash None, so the preference is tracked at send time. submitter_email = None if self.submitter_email != submitter_email: changes.append("submitter email") self.submitter_email = submitter_email return changes