def __init__(self, id, issueid, action, title=None, comment=None, threaddate=None, fromname=None, email=None, display_format=None, acl_adder=None, is_autosave=False, actual_time_hours=None): """ create draft thread """ self.id = str(id) self.issueid = issueid self.action = unicodify(action) self.title = unicodify(title) self.comment = unicodify(comment) if isinstance(threaddate, basestring): threaddate = DateTime(threaddate) self.threaddate = threaddate self.fromname = unicodify(fromname) if isinstance(email, basestring): email = asciify(email) self.email = email self.display_format = display_format self.is_autosave = bool(is_autosave) self.actual_time_hours = actual_time_hours if not acl_adder: # '', 0 or None acl_adder = '' self.acl_adder = acl_adder
def __init__(self, id, title, comment, threaddate, fromname, email, display_format=None, acl_adder='', submission_type='', actual_time_hours=None): """ create thread """ self.id = str(id) self.title = unicodify(title) self.comment = unicodify(comment) if isinstance(threaddate, basestring): threaddate = DateTime(threaddate) self.threaddate = threaddate self.fromname = unicodify(fromname) if isinstance(email, basestring): email = asciify(email, 'ignore') self.email = email if display_format: self.display_format = display_format else: self.display_format = self.default_display_format if acl_adder is None: acl_adder = '' self.acl_adder = acl_adder self.submission_type = submission_type self.email_message_id = None assert actual_time_hours is None or isinstance(actual_time_hours, float) self.actual_time_hours = actual_time_hours
def __init__(self, id, title, comment, fromname, email, notedate=None, display_format=None, acl_adder='', threadID=''): """ create thread """ self.id = str(id) self.title = unicodify(title) self.comment = unicodify(comment) if isinstance(notedate, basestring): notedate = DateTime(notedate) elif not notedate: notedate = DateTime() self.notedate = notedate self.fromname = unicodify(fromname) if isinstance(email, basestring): email = asciify(email, 'ignore') self.email = email self.display_format = display_format if acl_adder is None: acl_adder = '' self.acl_adder = acl_adder self.threadID = threadID
def _title_to_id(title): oid = asciify(title, 'ignore') oid = oid.replace(' ', '-') oid = safeId(oid) if len(oid) > 50: oid = oid[:50] while oid.endswith('-'): oid = oid[:-1] return oid
def _title_to_id(title): oid = asciify(title, 'ignore') oid = oid.replace(' ','-') oid = safeId(oid) if len(oid) > 50: oid = oid[:50] while oid.endswith('-'): oid = oid[:-1] return oid
def __init__(self, id, fromname, email, acl_adder='', blocks=None, change='add', change_html=None): self.id = str(id) self.fromname = unicodify(fromname) self.email = asciify(email) self.acl_adder = acl_adder if blocks is None: blocks = [] self.blocks = blocks if change not in VALID_CHANGES: raise ValueError("Invalid change value %r" % change) self.change = change if isinstance(change_html, str): change_html = unicodify(change_html) self.change_html = change_html
def _savePage(self, title, body, request): issueuser = self.getIssueUser() #cmfuser = self.getCMFUser() zopeuser = self.getZopeUser() if issueuser: acl_adder = ','.join(issueuser.getIssueUserIdentifier()) elif zopeuser: path = '/'.join(zopeuser.getPhysicalPath()) name = zopeuser.getUserName() acl_adder = ','.join([path, name]) fromname = request.get('fromname', '').strip() ckey = self.getCookiekey('name') if issueuser and issueuser.getFullname(): fromname = issueuser.getFullname() #elif cmfuser and cmfuser.getProperty('fullname'): # fromname = cmfuser.getProperty('fullname') elif not request.get('fromname') and self.has_cookie(ckey): fromname = self.get_cookie(ckey) elif request.get('fromname'): self.set_cookie(ckey, fromname) email = request.get('email', '').strip() ckey = self.getCookiekey('email') if issueuser and issueuser.getEmail(): email = issueuser.getEmail() #elif cmfuser and cmfuser.getProperty('email'): # email = cmfuser.getProperty('email') elif not request.get('email') and self.has_cookie(ckey): email = self.get_cookie(ckey) elif request.get('email'): self.set_cookie(ckey, asciify(email, 'replace')) self._updateModifyDate() # Also upload the fileattachments self._moveTempfiles(self) # upload new file attachments if request.get('fileattachment', []): self._uploadFileattachments(self, request.get('fileattachment')) #followupobject.index_object(idxs=['filenames']) self.nullifyTempfolderREQUEST() #if self.SaveDrafts(): # # make sure there aren't any drafts that match # # this recently added followupobject # self._dropMatchingDraftThreads(followupobject) # # # in fact, drop all drafts in this issue # self._cancelDraftThreads(autosaved_only=True) if request.get('notify-more-options'): email_addresses = request.get('notify_email') # check that they're all email address that are possible possible_email_addresses = self.Others2Notify(do='email', emailtoskip=email) email_addresses = [ x.strip() for x in email_addresses if x.strip() and x.strip() in possible_email_addresses ] if email_addresses: self.sendFollowupNotifications( followupobject, email_addresses, gentitle, status_change=action == 'add followup') elif request.has_key('notify'): # now, create and email-alert-queue object # using filtered email address # get who to notify email_addresses = self.Others2Notify(do='email', emailtoskip=email) if email_addresses: self._sendPageChangeNotifications(change, email_addresses, title) # catalog self.unindex_object() self.index_object()
def _savePage(self, title, body, request): issueuser = self.getIssueUser() #cmfuser = self.getCMFUser() zopeuser = self.getZopeUser() if issueuser: acl_adder = ','.join(issueuser.getIssueUserIdentifier()) elif zopeuser: path = '/'.join(zopeuser.getPhysicalPath()) name = zopeuser.getUserName() acl_adder = ','.join([path, name]) fromname = request.get('fromname','').strip() ckey = self.getCookiekey('name') if issueuser and issueuser.getFullname(): fromname = issueuser.getFullname() #elif cmfuser and cmfuser.getProperty('fullname'): # fromname = cmfuser.getProperty('fullname') elif not request.get('fromname') and self.has_cookie(ckey): fromname = self.get_cookie(ckey) elif request.get('fromname'): self.set_cookie(ckey, fromname) email = request.get('email','').strip() ckey = self.getCookiekey('email') if issueuser and issueuser.getEmail(): email = issueuser.getEmail() #elif cmfuser and cmfuser.getProperty('email'): # email = cmfuser.getProperty('email') elif not request.get('email') and self.has_cookie(ckey): email = self.get_cookie(ckey) elif request.get('email'): self.set_cookie(ckey, asciify(email, 'replace')) self._updateModifyDate() # Also upload the fileattachments self._moveTempfiles(self) # upload new file attachments if request.get('fileattachment', []): self._uploadFileattachments(self, request.get('fileattachment')) #followupobject.index_object(idxs=['filenames']) self.nullifyTempfolderREQUEST() #if self.SaveDrafts(): # # make sure there aren't any drafts that match # # this recently added followupobject # self._dropMatchingDraftThreads(followupobject) # # # in fact, drop all drafts in this issue # self._cancelDraftThreads(autosaved_only=True) if request.get('notify-more-options'): email_addresses = request.get('notify_email') # check that they're all email address that are possible possible_email_addresses = self.Others2Notify(do='email', emailtoskip=email) email_addresses = [x.strip() for x in email_addresses if x.strip() and x.strip() in possible_email_addresses] if email_addresses: self.sendFollowupNotifications(followupobject, email_addresses, gentitle, status_change=action == 'add followup') elif request.has_key('notify'): # now, create and email-alert-queue object # using filtered email address # get who to notify email_addresses = self.Others2Notify(do='email', emailtoskip=email) if email_addresses: self._sendPageChangeNotifications(change, email_addresses, title) # catalog self.unindex_object() self.index_object()