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
ff808ddb
Commit
ff808ddb
authored
Feb 19, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various coding style improvements
parent
fe237549
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
11 deletions
+41
-11
weblate/trans/models.py
weblate/trans/models.py
+41
-11
No files found.
weblate/trans/models.py
View file @
ff808ddb
...
@@ -1933,7 +1933,8 @@ class Translation(models.Model):
...
@@ -1933,7 +1933,8 @@ class Translation(models.Model):
def
git_needs_push
(
self
):
def
git_needs_push
(
self
):
return
self
.
subproject
.
git_needs_push
()
return
self
.
subproject
.
git_needs_push
()
def
git_commit
(
self
,
author
,
timestamp
,
force_commit
=
False
,
sync
=
False
,
skip_push
=
False
):
def
git_commit
(
self
,
author
,
timestamp
,
force_commit
=
False
,
sync
=
False
,
skip_push
=
False
):
'''
'''
Wrapper for commiting translation to git.
Wrapper for commiting translation to git.
...
@@ -2044,7 +2045,10 @@ class Translation(models.Model):
...
@@ -2044,7 +2045,10 @@ class Translation(models.Model):
author
=
self
.
get_author_name
(
request
.
user
)
author
=
self
.
get_author_name
(
request
.
user
)
# Update po file header
# Update po file header
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
()
)
# Update genric headers
# Update genric headers
store
.
updateheader
(
store
.
updateheader
(
...
@@ -2089,7 +2093,10 @@ class Translation(models.Model):
...
@@ -2089,7 +2093,10 @@ class Translation(models.Model):
# All checks
# All checks
sourcechecks
=
self
.
unit_set
.
count_type
(
'sourcechecks'
,
self
)
sourcechecks
=
self
.
unit_set
.
count_type
(
'sourcechecks'
,
self
)
if
sourcechecks
>
0
:
if
sourcechecks
>
0
:
result
.
append
((
'sourcechecks'
,
_
(
'Strings with any failing checks (%d)'
)
%
sourcechecks
))
result
.
append
((
'sourcechecks'
,
_
(
'Strings with any failing checks (%d)'
)
%
sourcechecks
))
# Process specific checks
# Process specific checks
for
check
in
CHECKS
:
for
check
in
CHECKS
:
...
@@ -2103,7 +2110,10 @@ class Translation(models.Model):
...
@@ -2103,7 +2110,10 @@ class Translation(models.Model):
# Grab comments
# Grab comments
sourcecomments
=
self
.
unit_set
.
count_type
(
'sourcecomments'
,
self
)
sourcecomments
=
self
.
unit_set
.
count_type
(
'sourcecomments'
,
self
)
if
sourcecomments
>
0
:
if
sourcecomments
>
0
:
result
.
append
((
'sourcecomments'
,
_
(
'Strings with comments (%d)'
)
%
sourcecomments
))
result
.
append
((
'sourcecomments'
,
_
(
'Strings with comments (%d)'
)
%
sourcecomments
))
return
result
return
result
...
@@ -2164,7 +2174,8 @@ class Translation(models.Model):
...
@@ -2164,7 +2174,8 @@ class Translation(models.Model):
return
result
return
result
def
merge_store
(
self
,
author
,
store2
,
overwrite
,
mergefuzzy
=
False
,
merge_header
=
True
):
def
merge_store
(
self
,
author
,
store2
,
overwrite
,
mergefuzzy
=
False
,
merge_header
=
True
):
'''
'''
Merges ttkit store into current translation.
Merges ttkit store into current translation.
'''
'''
...
@@ -2216,7 +2227,8 @@ class Translation(models.Model):
...
@@ -2216,7 +2227,8 @@ class Translation(models.Model):
return
ret
return
ret
def
merge_upload
(
self
,
request
,
fileobj
,
overwrite
,
author
=
None
,
mergefuzzy
=
False
,
merge_header
=
True
):
def
merge_upload
(
self
,
request
,
fileobj
,
overwrite
,
author
=
None
,
mergefuzzy
=
False
,
merge_header
=
True
):
'''
'''
Top level handler for file uploads.
Top level handler for file uploads.
'''
'''
...
@@ -2482,13 +2494,25 @@ class Unit(models.Model):
...
@@ -2482,13 +2494,25 @@ class Unit(models.Model):
(
saved
,
pounit
)
=
self
.
translation
.
update_unit
(
self
,
request
)
(
saved
,
pounit
)
=
self
.
translation
.
update_unit
(
self
,
request
)
except
FileLockException
:
except
FileLockException
:
logger
.
error
(
'failed to lock backend for %s!'
,
self
)
logger
.
error
(
'failed to lock backend for %s!'
,
self
)
messages
.
error
(
request
,
_
(
'Failed to store message in the backend, lock timeout occurred!'
))
messages
.
error
(
request
,
_
(
'Failed to store message in the backend, '
'lock timeout occurred!'
)
)
return
False
return
False
# Handle situation when backend did not find the message
# Handle situation when backend did not find the message
if
pounit
is
None
:
if
pounit
is
None
:
logger
.
error
(
'message %s disappeared!'
,
self
)
logger
.
error
(
'message %s disappeared!'
,
self
)
messages
.
error
(
request
,
_
(
'Message not found in backend storage, it is probably corrupted.'
))
messages
.
error
(
request
,
_
(
'Message not found in backend storage, '
'it is probably corrupted.'
)
)
# Try reloading from backend
# Try reloading from backend
self
.
translation
.
update_from_blob
(
True
)
self
.
translation
.
update_from_blob
(
True
)
return
False
return
False
...
@@ -2543,7 +2567,9 @@ class Unit(models.Model):
...
@@ -2543,7 +2567,9 @@ class Unit(models.Model):
request
.
user
request
.
user
)
)
for
subscription
in
subscriptions
:
for
subscription
in
subscriptions
:
subscription
.
notify_new_contributor
(
self
.
translation
,
request
.
user
)
subscription
.
notify_new_contributor
(
self
.
translation
,
request
.
user
)
# Generate Change object for this change
# Generate Change object for this change
if
gen_change
:
if
gen_change
:
...
@@ -2581,7 +2607,10 @@ class Unit(models.Model):
...
@@ -2581,7 +2607,10 @@ class Unit(models.Model):
'''
'''
# Warn if request is not coming from backend
# Warn if request is not coming from backend
if
not
'backend'
in
kwargs
:
if
not
'backend'
in
kwargs
:
logger
.
error
(
'Unit.save called without backend sync: %s'
,
''
.
join
(
traceback
.
format_stack
()))
logger
.
error
(
'Unit.save called without backend sync: %s'
,
''
.
join
(
traceback
.
format_stack
())
)
else
:
else
:
del
kwargs
[
'backend'
]
del
kwargs
[
'backend'
]
...
@@ -2718,9 +2747,10 @@ class Unit(models.Model):
...
@@ -2718,9 +2747,10 @@ class Unit(models.Model):
if
self
.
fuzzy
or
not
self
.
translated
:
if
self
.
fuzzy
or
not
self
.
translated
:
# Check whether there is any message with same source
# Check whether there is any message with same source
project
=
self
.
translation
.
subproject
.
project
same_source
=
Unit
.
objects
.
filter
(
same_source
=
Unit
.
objects
.
filter
(
translation__language
=
self
.
translation
.
language
,
translation__language
=
self
.
translation
.
language
,
translation__subproject__project
=
self
.
translation
.
subproject
.
project
,
translation__subproject__project
=
project
,
checksum
=
self
.
checksum
,
checksum
=
self
.
checksum
,
fuzzy
=
False
,
fuzzy
=
False
,
).
exclude
(
).
exclude
(
...
...
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