Beispiel #1
0
    def get_user_name(self, config_file=None):
        """
        Returns user's name from global configuration file.

        :param config_file: A path to file which should be used to retrieve
          configuration from (might also be a list of file paths)
        """
        username = self.get_config_value('ui', 'username')
        if username:
            return author_name(username)
        return None
Beispiel #2
0
    def get_user_name(self, config_file=None):
        """
        Returns user's name from global configuration file.

        :param config_file: A path to file which should be used to retrieve
          configuration from (might also be a list of file paths)
        """
        username = self.get_config_value('ui', 'username')
        if username:
            return author_name(username)
        return None
Beispiel #3
0
def person(author, show_attr="username"):
    """Find the user identified by 'author', return one of the users attributes,
    default to the username attribute, None if there is no user"""
    from kallithea.model.db import User
    # if author is already an instance use it for extraction
    if isinstance(author, User):
        return getattr(author, show_attr)

    value = user_attr_or_none(author, show_attr)
    if value is not None:
        return value

    # Still nothing?  Just pass back the author name if any, else the email
    return author_name(author) or email(author)
Beispiel #4
0
def person(author, show_attr="username"):
    """Find the user identified by 'author', return one of the users attributes,
    default to the username attribute, None if there is no user"""
    from kallithea.model.db import User
    # attr to return from fetched user
    person_getter = lambda usr: getattr(usr, show_attr)

    # if author is already an instance use it for extraction
    if isinstance(author, User):
        return person_getter(author)

    user = user_or_none(author)
    if user is not None:
        return person_getter(user)

    # Still nothing?  Just pass back the author name if any, else the email
    return author_name(author) or email(author)
Beispiel #5
0
def person(author, show_attr="username"):
    """Find the user identified by 'author', return one of the users attributes,
    default to the username attribute, None if there is no user"""
    from kallithea.model.db import User
    # attr to return from fetched user
    person_getter = lambda usr: getattr(usr, show_attr)

    # if author is already an instance use it for extraction
    if isinstance(author, User):
        return person_getter(author)

    user = user_or_none(author)
    if user is not None:
        return person_getter(user)

    # Still nothing?  Just pass back the author name if any, else the email
    return author_name(author) or email(author)
Beispiel #6
0
    def author_name(self):
        """
        Returns Author name for given commit
        """

        return author_name(self.author)
Beispiel #7
0
    def committer_name(self):
        """
        Returns Author name for given commit
        """

        return author_name(self.committer)
Beispiel #8
0
    def test_author_name(self):

        for test_str, result in self.TEST_AUTHORS:
            self.assertEqual(result[0], author_name(test_str))
Beispiel #9
0
    def test_author_name(self):

        for test_str, result in self.TEST_AUTHORS:
            self.assertEqual(result[0], author_name(test_str))
Beispiel #10
0
 def test_author_name(self):
     for test_str, result in self.TEST_AUTHORS:
         assert result[0] == author_name(test_str)
Beispiel #11
0
    def author_name(self):
        """
        Returns Author name for given commit
        """

        return author_name(self.author)
Beispiel #12
0
    def committer_name(self):
        """
        Returns Author name for given commit
        """

        return author_name(self.committer)