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
e54fc89a
Commit
e54fc89a
authored
Aug 12, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store contentsum with unit (issue #326)
parent
a6297625
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
trans/formats.py
trans/formats.py
+11
-0
trans/models/unit.py
trans/models/unit.py
+3
-0
No files found.
trans/formats.py
View file @
e54fc89a
...
...
@@ -216,6 +216,17 @@ class FileUnit(object):
md5
.
update
(
self
.
get_context
().
encode
(
'utf-8'
))
return
md5
.
hexdigest
()
def
get_contentsum
(
self
):
'''
Returns checksum of source string and conntext, used for quick lookup.
We use MD5 as it is faster than SHA1.
'''
md5
=
hashlib
.
md5
()
md5
.
update
(
self
.
get_source
().
encode
(
'utf-8'
))
md5
.
update
(
self
.
get_context
().
encode
(
'utf-8'
))
return
md5
.
hexdigest
()
def
is_translated
(
self
):
'''
Checks whether unit is translated.
...
...
trans/models/unit.py
View file @
e54fc89a
...
...
@@ -379,6 +379,7 @@ class Unit(models.Model):
fuzzy
=
unit
.
is_fuzzy
()
translated
=
unit
.
is_translated
()
previous_source
=
unit
.
get_previous_source
()
contentsum
=
unit
.
get_contentsum
()
# Monolingual files handling
if
unit
.
template
is
not
None
:
...
...
@@ -412,6 +413,7 @@ class Unit(models.Model):
translated
==
self
.
translated
and
comment
==
self
.
comment
and
pos
==
self
.
position
and
contentsum
==
self
.
contentsum
and
previous_source
==
self
.
previous_source
):
return
...
...
@@ -424,6 +426,7 @@ class Unit(models.Model):
self
.
fuzzy
=
fuzzy
self
.
translated
=
translated
self
.
comment
=
comment
self
.
contentsum
=
contentsum
self
.
previous_source
=
previous_source
self
.
save
(
force_insert
=
created
,
...
...
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