Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
addaf351
Commit
addaf351
authored
Mar 27, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for commit need
parent
367942b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
trans/models.py
trans/models.py
+21
-6
No files found.
trans/models.py
View file @
addaf351
...
...
@@ -357,11 +357,24 @@ class Translation(models.Model):
self
.
revision
=
blob_hash
self
.
save
()
def
get_author_name
(
self
,
request
):
full_name
=
request
.
user
.
get_full_name
()
def
get_last_author
(
self
):
try
:
change
=
self
.
change_set
.
order_by
(
'-timestamp'
)[
0
]
return
self
.
get_author_name
(
change
.
user
)
except
:
return
None
def
pre_commit
(
self
,
author
):
last
=
self
.
get_last_author
()
if
author
==
last
or
last
is
None
:
return
self
.
git_commit
(
last
,
True
)
def
get_author_name
(
self
,
user
):
full_name
=
user
.
get_full_name
()
if
full_name
==
''
:
full_name
=
request
.
user
.
username
return
'%s <%s>'
%
(
full_name
,
request
.
user
.
email
)
full_name
=
user
.
username
return
'%s <%s>'
%
(
full_name
,
user
.
email
)
def
__git_commit
(
self
,
gitrepo
,
author
):
'''
...
...
@@ -419,7 +432,8 @@ class Translation(models.Model):
# We should have only one match
break
if
need_save
:
author
=
self
.
get_author_name
(
request
)
author
=
self
.
get_author_name
(
request
.
user
)
self
.
pre_commit
(
author
)
if
hasattr
(
store
,
'updateheader'
):
po_revision_date
=
datetime
.
now
().
strftime
(
'%Y-%m-%d %H:%M'
)
+
poheader
.
tzstring
()
...
...
@@ -483,6 +497,7 @@ class Translation(models.Model):
if
not
overwrite
and
unit1
.
istranslated
():
continue
unit1
.
merge
(
unit2
,
overwrite
=
True
,
comments
=
False
)
self
.
pre_commit
(
author
)
store1
.
save
()
ret
=
self
.
git_commit
(
author
,
True
)
self
.
check_sync
()
...
...
@@ -496,7 +511,7 @@ class Translation(models.Model):
fileobj
.
mode
=
"r"
store2
=
factory
.
getobject
(
fileobj
)
if
author
is
None
:
author
=
self
.
get_author_name
(
request
)
author
=
self
.
get_author_name
(
request
.
user
)
ret
=
False
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment