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
7540d39c
Commit
7540d39c
authored
Feb 02, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store language code for update
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
4f58d14a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
3 deletions
+27
-3
weblate/trans/management/commands/update_index.py
weblate/trans/management/commands/update_index.py
+1
-1
weblate/trans/migrations/0057_indexupdate_language_code.py
weblate/trans/migrations/0057_indexupdate_language_code.py
+21
-0
weblate/trans/models/search.py
weblate/trans/models/search.py
+1
-0
weblate/trans/search.py
weblate/trans/search.py
+4
-2
No files found.
weblate/trans/management/commands/update_index.py
View file @
7540d39c
...
...
@@ -54,7 +54,7 @@ class Command(BaseCommand):
indexupdates
.
add
(
update
.
pk
)
delete_search_unit
(
update
.
unitid
,
update
.
translation
.
language
.
code
update
.
language_
code
)
# Delete processed updates
...
...
weblate/trans/migrations/0057_indexupdate_language_code.py
0 → 100644
View file @
7540d39c
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-02 12:28
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'trans'
,
'0056_auto_20160202_1224'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'indexupdate'
,
name
=
'language_code'
,
field
=
models
.
SlugField
(
default
=
''
),
preserve_default
=
False
,
),
]
weblate/trans/models/search.py
View file @
7540d39c
...
...
@@ -27,6 +27,7 @@ class IndexUpdate(models.Model):
unitid
=
models
.
IntegerField
(
unique
=
True
)
source
=
models
.
BooleanField
(
default
=
True
)
to_delete
=
models
.
BooleanField
(
default
=
False
)
language_code
=
models
.
SlugField
()
class
Meta
(
object
):
app_label
=
'trans'
...
...
weblate/trans/search.py
View file @
7540d39c
...
...
@@ -190,7 +190,7 @@ def update_index(units, source_units=None):
writer
.
close
()
def
add_index_update
(
unit_id
,
source
,
to_delete
):
def
add_index_update
(
unit_id
,
source
,
to_delete
,
language_code
=
''
):
from
weblate.trans.models.search
import
IndexUpdate
try
:
with
transaction
.
atomic
():
...
...
@@ -198,6 +198,7 @@ def add_index_update(unit_id, source, to_delete):
unitid
=
unit_id
,
source
=
source
,
to_delete
=
to_delete
,
language_code
=
language_code
,
)
# pylint: disable=E0712
except
IntegrityError
:
...
...
@@ -208,6 +209,7 @@ def add_index_update(unit_id, source, to_delete):
update
.
source
=
True
if
to_delete
:
update
.
to_delete
=
True
update
.
language_code
=
language_code
update
.
save
()
except
IndexUpdate
.
DoesNotExist
:
# It did exist, but was deleted meanwhile
...
...
@@ -311,7 +313,7 @@ def clean_search_unit(pk, lang):
"""Cleanups search index on unit deletion."""
if
appsettings
.
OFFLOAD_INDEXING
:
from
weblate.trans.models.search
import
IndexUpdate
add_index_update
(
pk
,
False
,
True
)
add_index_update
(
pk
,
False
,
True
,
lang
)
else
:
delete_search_unit
(
pk
,
lang
)
...
...
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