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
047ac44b
Commit
047ac44b
authored
Nov 08, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup unit commands
parent
fdf98661
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
weblate/trans/management/commands/rebuild_index.py
weblate/trans/management/commands/rebuild_index.py
+12
-9
weblate/trans/management/commands/updatechecks.py
weblate/trans/management/commands/updatechecks.py
+3
-5
No files found.
weblate/trans/management/commands/rebuild_index.py
View file @
047ac44b
...
...
@@ -36,30 +36,33 @@ class Command(WeblateCommand):
def
handle
(
self
,
*
args
,
**
options
):
languages
=
Language
.
objects
.
all
()
# Optionally rebuild indices from scratch
if
options
[
'clean'
]:
create_source_index
()
for
lang
in
languages
:
create_target_index
(
lang
=
lang
.
code
)
base
=
self
.
get_units
(
*
args
,
**
options
)
if
base
.
count
()
==
0
:
return
units
=
self
.
get_units
(
*
args
,
**
options
)
# Update source index
with
FULLTEXT_INDEX
.
source_writer
(
buffered
=
False
)
as
writer
:
for
unit
in
base
.
values
(
'checksum'
,
'source'
,
'context'
).
iterator
():
for
unit
in
units
.
values
(
'checksum'
,
'source'
,
'context'
).
iterator
():
Unit
.
objects
.
add_to_source_index
(
unit
[
'checksum'
],
unit
[
'source'
],
unit
[
'context'
],
writer
)
writer
)
# Update per language indices
for
lang
in
languages
:
with
FULLTEXT_INDEX
.
target_writer
(
lang
=
lang
.
code
,
buffered
=
False
)
as
writer
:
for
unit
in
base
.
filter
(
translation__language
=
lang
).
exclude
(
target
=
''
)
.
values
(
'checksum'
,
'target'
).
iterator
():
language_units
=
units
.
filter
(
translation__language
=
lang
).
exclude
(
target
=
''
)
for
unit
in
language_units
.
values
(
'checksum'
,
'target'
).
iterator
():
Unit
.
objects
.
add_to_target_index
(
unit
[
'checksum'
],
unit
[
'target'
],
writer
)
writer
)
weblate/trans/management/commands/updatechecks.py
View file @
047ac44b
...
...
@@ -24,10 +24,8 @@ class Command(WeblateCommand):
help
=
'updates checks for units'
def
handle
(
self
,
*
args
,
**
options
):
base
=
self
.
get_units
(
*
args
,
**
options
).
filter
(
translated
=
True
)
units
=
self
.
get_units
(
*
args
,
**
options
).
filter
(
translated
=
True
)
if
base
.
count
()
==
0
:
return
for
unit
in
base
.
iterator
():
# Invoke check for every unit
for
unit
in
units
.
iterator
():
unit
.
check
()
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