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
dd2e7816
Commit
dd2e7816
authored
Feb 13, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use unctools.reduce for Python 3 compatibility
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
4829e3d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
weblate/trans/models/unit.py
weblate/trans/models/unit.py
+2
-3
weblate/trans/search.py
weblate/trans/search.py
+2
-1
No files found.
weblate/trans/models/unit.py
View file @
dd2e7816
...
@@ -18,10 +18,9 @@
...
@@ -18,10 +18,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
import
functools
import
traceback
import
traceback
import
multiprocessing
import
multiprocessing
# pylint: disable=W0622
from
functools
import
reduce
from
django.db
import
models
from
django.db
import
models
from
django.db.models
import
Q
from
django.db.models
import
Q
...
@@ -235,7 +234,7 @@ class UnitManager(models.Manager):
...
@@ -235,7 +234,7 @@ class UnitManager(models.Manager):
if
params
[
param
]:
if
params
[
param
]:
queries
.
append
(
param
)
queries
.
append
(
param
)
query
=
reduce
(
query
=
functools
.
reduce
(
lambda
q
,
value
:
lambda
q
,
value
:
q
|
Q
(
**
{
'%s%s'
%
(
value
,
modifier
):
params
[
'q'
]}),
q
|
Q
(
**
{
'%s%s'
%
(
value
,
modifier
):
params
[
'q'
]}),
queries
,
queries
,
...
...
weblate/trans/search.py
View file @
dd2e7816
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
Whoosh based full text search.
Whoosh based full text search.
'''
'''
import
functools
import
shutil
import
shutil
from
whoosh.fields
import
SchemaClass
,
TEXT
,
NUMERIC
from
whoosh.fields
import
SchemaClass
,
TEXT
,
NUMERIC
from
whoosh.filedb.filestore
import
FileStorage
from
whoosh.filedb.filestore
import
FileStorage
...
@@ -250,7 +251,7 @@ def base_search(index, query, params, search, schema):
...
@@ -250,7 +251,7 @@ def base_search(index, query, params, search, schema):
queries
.
append
(
queries
.
append
(
parser
.
parse
(
query
)
parser
.
parse
(
query
)
)
)
terms
=
reduce
(
lambda
x
,
y
:
x
|
y
,
queries
)
terms
=
functools
.
reduce
(
lambda
x
,
y
:
x
|
y
,
queries
)
return
[
result
[
'pk'
]
for
result
in
searcher
.
search
(
terms
)]
return
[
result
[
'pk'
]
for
result
in
searcher
.
search
(
terms
)]
...
...
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