def get_posted_emails(ipr): """Return a list of messages suitable to initialize a NotifyFormset for the notify view when a new disclosure is posted""" messages = [] addrs = gather_address_lists('ipr_posting_confirmation',ipr=ipr).as_strings(compact=False) context = dict( to_email=addrs.to, to_name=ipr.submitter_name, cc_email=addrs.cc, ipr=ipr) text = render_to_string('ipr/posted_submitter_email.txt',context) messages.append(text) # add email to related document authors / parties if ipr.iprdocrel_set.all(): messages.extend(get_document_emails(ipr)) # if Generic disclosure add message for General Area AD if isinstance(ipr, (GenericIprDisclosure,NonDocSpecificIprDisclosure)): role = Role.objects.filter(group__acronym='gen',name='ad').first() context = dict( to_email=role.email.address, to_name=role.person.name, ipr=ipr) text = render_to_string('ipr/posted_generic_email.txt',context) messages.append(text) return messages
def get_posted_emails(ipr): """Return a list of messages suitable to initialize a NotifyFormset for the notify view when a new disclosure is posted""" messages = [] addrs = gather_address_lists('ipr_posting_confirmation', ipr=ipr).as_strings(compact=False) context = dict(to_email=addrs.to, to_name=ipr.submitter_name, cc_email=addrs.cc, ipr=ipr) text = render_to_string('ipr/posted_submitter_email.txt', context) messages.append(text) # add email to related document authors / parties if ipr.iprdocrel_set.all(): messages.extend(get_document_emails(ipr)) # if Generic disclosure add message for General Area AD if isinstance(ipr, (GenericIprDisclosure, NonDocSpecificIprDisclosure)): role = Role.objects.filter(group__acronym='gen', name='ad').first() context = dict(to_email=role.email.address, to_name=role.person.name, ipr=ipr) text = render_to_string('ipr/posted_generic_email.txt', context) messages.append(text) return messages
def get_messages(self, basket, offers_before, offers_after, include_buttons=True): messages = [] messages.extend(self.get_offer_messages(offers_before, offers_after)) messages.extend(self.get_new_total_messages(basket, include_buttons)) return messages
def __iter__(self): if not get_user(self.request).is_authenticated(): return super(PersistentMessageStorage, self).__iter__() self.used = True messages = [] messages.extend(self._loaded_messages) if self._queued_messages: messages.extend(self._queued_messages) return iter(messages)
def __iter__(self): if self.is_anonymous: return super(PersistentMessageStorage, self).__iter__() self.used = True messages = [] messages.extend(self._loaded_messages) if self._queued_messages: messages.extend(self._queued_messages) return iter(messages)
def getAllMessages(): response = service.users().messages().list(userId='me', labelIds=['INBOX']).execute() messages = [] if 'messages' in response: messages.extend(response['messages']) messagefull = [] for message in messages: messagefull.append(GetMessageString(service, 'me', message['id'])) return messagefull
def inboxmessagenumber(): response = service.users().messages().list(userId='me', labelIds=['INBOX']).execute() messages = [] if 'messages' in response: messages.extend(response['messages']) while 'nextPageToken' in response: page_token = response['nextPageToken'] response = service.users().messages().list( userId='me', labelIds=['INBOX'], pageToken=page_token).execute() messages.extend(response['messages']) messagefull = [] for message in messages: messagefull.append(GetMessage(service, 'me', message['id'])) global inboxmessages inboxmessages = len(messagefull) return messagefull