Safer author name generating
This commit is contained in:
parent
d9afaea91b
commit
6aede7af1f
@ -296,6 +296,12 @@ class Translation(models.Model):
|
|||||||
self.revision = blob.hexsha
|
self.revision = blob.hexsha
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
def get_author_name(self, request):
|
||||||
|
full_name = request.user.get_full_name()
|
||||||
|
if full_name == '':
|
||||||
|
full_name = request.user.username
|
||||||
|
return '%s <%s>' % (full_name, request.user.email)
|
||||||
|
|
||||||
def git_commit(self, author):
|
def git_commit(self, author):
|
||||||
'''
|
'''
|
||||||
Commits translation to git.
|
Commits translation to git.
|
||||||
@ -336,7 +342,7 @@ 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)
|
author = self.get_author_name(request)
|
||||||
if hasattr(store, 'updateheader'):
|
if hasattr(store, 'updateheader'):
|
||||||
po_revision_date = datetime.now().strftime('%Y-%m-%d %H:%M') + poheader.tzstring()
|
po_revision_date = datetime.now().strftime('%Y-%m-%d %H:%M') + poheader.tzstring()
|
||||||
|
|
||||||
@ -394,7 +400,7 @@ class Translation(models.Model):
|
|||||||
continue
|
continue
|
||||||
unit1.merge(unit2, overwrite=overwrite)
|
unit1.merge(unit2, overwrite=overwrite)
|
||||||
store1.save()
|
store1.save()
|
||||||
author = u'%s <%s>' % (request.user.get_full_name(), request.user.email)
|
author = self.get_author_name(request)
|
||||||
ret = self.git_commit(author)
|
ret = self.git_commit(author)
|
||||||
self.check_sync()
|
self.check_sync()
|
||||||
return ret
|
return ret
|
||||||
|
Loading…
Reference in New Issue
Block a user