示例#1
0
文件: tasks.py 项目: hfeeki/bhwsg
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)
示例#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)        
示例#3
0
文件: models.py 项目: hfeeki/bhwsg
 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)
示例#4
0
文件: models.py 项目: hfeeki/bhwsg
    def get_mail(self, user, **kwargs):
        queryset = self.get_user_mails(user).prefetch_related('readers')

        return get_object_or_None(queryset, **kwargs)
示例#5
0
文件: smtp.py 项目: hfeeki/bhwsg
 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