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
6d88952d
Commit
6d88952d
authored
Feb 29, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly handle when message has disappeared
parent
85c0ddb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
trans/views.py
trans/views.py
+15
-9
No files found.
trans/views.py
View file @
6d88952d
...
...
@@ -52,20 +52,26 @@ def translate(request, project, subproject, lang):
except
:
pos
=
-
1
unit
=
None
# Any form submitted?
if
request
.
method
==
'POST'
:
form
=
TranslationForm
(
request
.
POST
)
if
form
.
is_valid
():
obj
.
check_sync
()
unit
=
Unit
.
objects
.
get
(
checksum
=
form
.
cleaned_data
[
'checksum'
],
translation
=
obj
)
unit
.
target
=
form
.
cleaned_data
[
'target'
]
unit
.
fuzzy
=
form
.
cleaned_data
[
'fuzzy'
]
unit
.
save_backend
(
request
)
# Check and save
return
HttpResponseRedirect
(
'%s?type=%s&oldpos=%d'
%
(
obj
.
get_translate_url
(),
rqtype
,
pos
))
else
:
try
:
unit
=
Unit
.
objects
.
get
(
checksum
=
form
.
cleaned_data
[
'checksum'
],
translation
=
obj
)
unit
.
target
=
form
.
cleaned_data
[
'target'
]
unit
.
fuzzy
=
form
.
cleaned_data
[
'fuzzy'
]
unit
.
save_backend
(
request
)
# Check and save
return
HttpResponseRedirect
(
'%s?type=%s&oldpos=%d'
%
(
obj
.
get_translate_url
(),
rqtype
,
pos
))
except
Unit
.
DoesNotExist
:
messages
.
add_message
(
request
,
messages
.
ERROR
,
_
(
'Message you wanted to translate is no longer available!'
))
# If we failed to get unit above or on no POST
if
unit
is
None
:
# What unit to show
if
direction
==
'back'
:
units
=
obj
.
unit_set
.
filter_type
(
rqtype
).
filter
(
position__lt
=
pos
)
...
...
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