Beispiel #1
0
def handle_mail(mail_dict):
    from inbox.models import Mail, Inbox
    """
        Save mail to Inbox model. Check and apply handlig rules for email.
    """
    inbox = get_object_or_None(Inbox, slug=mail_dict.pop('inbox'))

    if inbox:
        Mail.objects.new_mail(inbox, mail_dict)
Beispiel #2
0
 def person(self):
     """
     Return the user's :class:`Person` instance.
     """
     from persons.models import Person
     return get_object_or_None(Person, user=self)        
Beispiel #3
0
 def get_inbox(self, user, **kwargs):
     """ Get inbox for given User """
     queryset = self.get_query_set().filter(users=user).prefetch_related('users')
     return get_object_or_None(queryset, **kwargs)
Beispiel #4
0
    def get_mail(self, user, **kwargs):
        queryset = self.get_user_mails(user).prefetch_related('readers')

        return get_object_or_None(queryset, **kwargs)
Beispiel #5
0
 def _validate(self, username, password):
     # Get inbox, using credintails
     inbox = get_object_or_None(Inbox, slug=username, password=password)
     return True if inbox else False