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
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)
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)
def author_name(self): """ Returns Author name for given commit """ return author_name(self.author)
def committer_name(self): """ Returns Author name for given commit """ return author_name(self.committer)
def test_author_name(self): for test_str, result in self.TEST_AUTHORS: self.assertEqual(result[0], author_name(test_str))
def test_author_name(self): for test_str, result in self.TEST_AUTHORS: assert result[0] == author_name(test_str)