Move author definition

This commit is contained in:
Michal Čihař 2012-02-28 14:30:09 +01:00
parent c5892f62d0
commit 89a7da30bf

View File

@ -222,12 +222,11 @@ class Translation(models.Model):
self.revision = blob.hexsha self.revision = blob.hexsha
self.save() self.save()
def git_commit(self, request): def git_commit(self, author):
''' '''
Commits translation to git. Commits translation to git.
''' '''
repo = self.subproject.get_repo() repo = self.subproject.get_repo()
author = '%s <%s>' % (request.user.get_full_name(), request.user.email)
logger.info('Commiting %s as %s', self.filename, author) logger.info('Commiting %s as %s', self.filename, author)
repo.git.commit( repo.git.commit(
self.filename, self.filename,
@ -254,8 +253,9 @@ class Translation(models.Model):
# We should have only one match # We should have only one match
break break
if need_save: if need_save:
author = '%s <%s>' % (request.user.get_full_name(), request.user.email)
store.save() store.save()
self.git_commit(request) self.git_commit(author)
class Unit(models.Model): class Unit(models.Model):
translation = models.ForeignKey(Translation) translation = models.ForeignKey(Translation)