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.save()
def git_commit(self, request):
def git_commit(self, author):
'''
Commits translation to git.
'''
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)
repo.git.commit(
self.filename,
@ -254,8 +253,9 @@ class Translation(models.Model):
# We should have only one match
break
if need_save:
author = '%s <%s>' % (request.user.get_full_name(), request.user.email)
store.save()
self.git_commit(request)
self.git_commit(author)
class Unit(models.Model):
translation = models.ForeignKey(Translation)