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
847623d8
Commit
847623d8
authored
Jul 12, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
factor out change generating
parent
cc4d60a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
19 deletions
+27
-19
trans/models/unit.py
trans/models/unit.py
+27
-19
No files found.
trans/models/unit.py
View file @
847623d8
...
...
@@ -665,25 +665,7 @@ class Unit(models.Model):
# Generate Change object for this change
if
gen_change
:
if
change_action
is
not
None
:
action
=
change_action
elif
oldunit
.
translated
:
action
=
Change
.
ACTION_CHANGE
else
:
action
=
Change
.
ACTION_NEW
if
self
.
translation
.
subproject
.
save_history
:
history_target
=
self
.
target
else
:
history_target
=
''
# Create change object
Change
.
objects
.
create
(
unit
=
self
,
translation
=
self
.
translation
,
action
=
action
,
user
=
request
.
user
,
target
=
history_target
)
self
.
generate_change
(
request
,
oldunit
,
change_action
)
# Force commiting on completing translation
if
(
old_translated
<
self
.
translation
.
translated
...
...
@@ -701,6 +683,32 @@ class Unit(models.Model):
return
True
def
generate_change
(
self
,
request
,
oldunit
,
change_action
):
'''
Creates Change entry for saving unit.
'''
from
trans.models.changes
import
Change
if
change_action
is
not
None
:
action
=
change_action
elif
oldunit
.
translated
:
action
=
Change
.
ACTION_CHANGE
else
:
action
=
Change
.
ACTION_NEW
if
self
.
translation
.
subproject
.
save_history
:
history_target
=
self
.
target
else
:
history_target
=
''
# Create change object
Change
.
objects
.
create
(
unit
=
self
,
translation
=
self
.
translation
,
action
=
action
,
user
=
request
.
user
,
target
=
history_target
)
def
save
(
self
,
*
args
,
**
kwargs
):
'''
Wrapper around save to warn when save did not come from
...
...
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