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
eaf3835e
Commit
eaf3835e
authored
Apr 12, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update checks flag during runtime
parent
ac391de5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
6 deletions
+32
-6
trans/models/unit.py
trans/models/unit.py
+13
-6
trans/models/unitdata.py
trans/models/unitdata.py
+19
-0
No files found.
trans/models/unit.py
View file @
eaf3835e
...
...
@@ -913,8 +913,6 @@ class Unit(models.Model):
'check'
,
flat
=
True
))
change
=
False
# Run all checks
for
check
in
checks_to_run
:
check_obj
=
CHECKS
[
check
]
...
...
@@ -932,7 +930,6 @@ class Unit(models.Model):
ignore
=
False
,
check
=
check
)
change
=
True
# Source check
if
check_obj
.
source
and
check_obj
.
check_source
(
src
,
self
):
if
check
in
old_source_checks
:
...
...
@@ -947,14 +944,24 @@ class Unit(models.Model):
ignore
=
False
,
check
=
check
)
change
=
True
# Delete no longer failing checks
if
cleanup_checks
:
self
.
cleanup_checks
(
old_source_checks
,
old_target_checks
)
# Invalidate checks cache
if
change
:
# Update failing checks flag
self
.
update_has_failing_check
()
def
update_has_failing_check
(
self
):
'''
Updates flag counting failing checks.
'''
has_failing_checks
=
len
(
self
.
active_checks
())
>
0
if
has_failing_checks
!=
self
.
has_failing_checks
self
.
has_failing_checks
=
has_failing_checks
self
.
save
()
# Invalidate checks cache
self
.
translation
.
invalidate_cache
()
def
nearby
(
self
):
...
...
trans/models/unitdata.py
View file @
eaf3835e
...
...
@@ -142,6 +142,25 @@ class Check(models.Model):
except
:
return
''
def
set_ignore
(
self
):
'''
Sets ignore flag.
'''
self
.
ignore
=
True
self
.
save
()
# Update related unit flags
related_units
=
Unit
.
objects
.
filter
(
checksum
=
self
.
checksum
,
translation__subproject__project
=
self
.
project
,
)
if
self
.
language
is
not
None
:
related_units
=
related_units
.
filter
(
translation__language
=
self
.
language
)
for
unit
in
related_units
:
unit
.
update_has_failing_check
()
class
ChangeManager
(
models
.
Manager
):
def
content
(
self
):
...
...
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