예제 #1
0
 def format(self):
     """
     Same as above, however takes a single `flagORM` and formates the datetime
     markdown.
     """
     self.formatedDescription = mdu.markClean(self.description)
     self.formatedDate = datetime.strftime(self.created, "%a %b %d, %Y @ %H:%I%p")
예제 #2
0
    def _search(items, value):
        """
        Searches the list `items` for the given value

        :param items: A list of ORM objects to search
        :param value: The value to search for, in this case
            value can be a username or an email, or an id
        """
        foundUser = []
        for user in items:
            if user.email == value \
                    or user.username == value \
                    or user.id == value:
                foundUser.append(user)
        if not foundUser:
            return None
        if len(foundUser)>1:
            raise multipleUsersError("Multiple Users", value)
        else:
            user = foundUser[0]
            user.formatedAbout = mdu.markClean(user.about)
            return user