Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
272b0be4
Commit
272b0be4
authored
Nov 16, 2016
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multiple_catalog: Index in all the catalogs available
parent
9c809286
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
151 additions
and
149 deletions
+151
-149
product/ZSQLCatalog/ZSQLCatalog.py
product/ZSQLCatalog/ZSQLCatalog.py
+151
-149
No files found.
product/ZSQLCatalog/ZSQLCatalog.py
View file @
272b0be4
...
...
@@ -716,11 +716,14 @@ class ZCatalog(Folder, Persistent, Implicit):
immediate_reindex_archive
=
1
,
**
kw
):
"""Catalog a list of objects.
"""
catalog_id_list
=
self
.
getERP5CatalogIdList
()
for
sql_catalog_id
in
catalog_id_list
:
catalog
=
self
.
getSQLCatalog
(
sql_catalog_id
)
hot_reindexing
=
(
self
.
hot_reindexing_state
is
not
None
)
and
\
(
catalog
is
not
None
)
and
\
(
self
.
source_sql_catalog_id
==
catalog
.
id
)
archiving
=
self
.
archive_path
is
not
None
wrapped_object_list
=
[]
failed_object_list
=
[]
url_list
=
[]
archive_list
=
[]
...
...
@@ -760,7 +763,6 @@ class ZCatalog(Folder, Persistent, Implicit):
default_catalog
=
self
.
getSQLCatalog
()
# Construct list of object to catalogged
current_catalog_object_list
=
[]
for
obj
in
object_list
:
if
hot_reindexing
:
try
:
...
...
@@ -798,7 +800,10 @@ class ZCatalog(Folder, Persistent, Implicit):
goto_current_catalog
=
1
if
goto_current_catalog
:
current_catalog_object_list
.
append
(
obj
)
# wrap object only when sure it will be reindex now
# thus security uid is also reindex
wrap_obj
=
self
.
wrapObject
(
obj
,
sql_catalog_id
=
sql_catalog_id
)
wrapped_object_list
.
append
(
wrap_obj
)
# run activity or execute for each archive depending on priority
if
catalog_dict
:
...
...
@@ -807,56 +812,49 @@ class ZCatalog(Folder, Persistent, Implicit):
# if we reindex in current catalog, do not relaunch an activity for this
continue
d
=
catalog_dict
[
catalog_id
]
# build the wrapped object list
wrapped_object_list_2
=
[]
for
obj
in
d
[
'obj'
]:
try
:
wrap_obj
=
self
.
wrapObject
(
obj
,
sql_catalog_id
=
catalog_id
)
wrapped_object_list_2
.
append
(
wrap_obj
)
except
ConflictError
:
raise
except
:
LOG
(
'WARNING ZSQLCatalog'
,
0
,
'wrapObject failed on the object %r'
%
(
obj
,),
error
=
sys
.
exc_info
())
failed_object_list
.
append
(
obj
)
# hot_reindexing is True when creating an object during a hot reindex, in this case, we don't want
# to reindex it in destination catalog, it will be recorded an play only once
if
not
hot_reindexing
and
self
.
hot_reindexing_state
!=
HOT_REINDEXING_DOUBLE_INDEXING_STATE
and
\
self
.
destination_sql_catalog_id
==
catalog_id
:
destination_catalog
=
self
.
getSQLCatalog
(
self
.
destination_sql_catalog_id
)
# reindex objects in destination catalog
destination_catalog
.
catalogObjectList
(
self
.
wrapObjectList
(
object_value_list
=
d
[
'obj'
],
catalog_value
=
destination_catalog
,
),
**
kw
)
destination_catalog
.
catalogObjectList
(
wrapped_object_list_2
,
**
kw
)
else
:
archive_catalog
=
self
.
getSQLCatalog
(
catalog_id
)
if
immediate_reindex_archive
:
archive_catalog
.
catalogObjectList
(
self
.
wrapObjectList
(
object_value_list
=
d
[
'obj'
],
catalog_value
=
archive_catalog
,
),
**
kw
)
archive_catalog
.
catalogObjectList
(
wrapped_object_list_2
,
**
kw
)
else
:
for
obj
in
d
[
'obj'
]:
obj
.
_reindexObject
(
sql_catalog_id
=
catalog_id
,
activate_kw
=
\
{
'priority'
:
d
[
'priority'
]},
disable_archive
=
1
,
**
kw
)
if
catalog
is
not
None
:
if
current_catalog_object_list
:
catalog
.
catalogObjectList
(
self
.
wrapObjectList
(
object_value_list
=
current_catalog_object_list
,
catalog_value
=
catalog
,
),
**
kw
)
if
wrapped_object_list
:
catalog
.
catalogObjectList
(
wrapped_object_list
,
**
kw
)
if
hot_reindexing
:
destination_catalog
=
self
.
getSQLCatalog
(
self
.
destination_sql_catalog_id
)
if
destination_catalog
.
id
!=
catalog
.
id
:
if
self
.
hot_reindexing_state
==
HOT_REINDEXING_RECORDING_STATE
:
destination_catalog
.
recordObjectList
(
url_list
,
1
)
elif
object_list
:
destination_catalog
.
catalogObjectList
(
self
.
wrapObjectList
(
object_value_list
=
object_list
,
catalog_value
=
destination_catalog
,
),
**
kw
)
else
:
wrapped_destination_object_list
=
[]
for
obj
in
object_list
:
wrap_obj
=
self
.
wrapObject
(
obj
,
sql_catalog_id
=
self
.
destination_sql_catalog_id
)
wrapped_destination_object_list
.
append
(
wrap_obj
)
if
wrapped_destination_object_list
:
destination_catalog
.
catalogObjectList
(
wrapped_destination_object_list
,
**
kw
)
object_list
[:]
=
failed_object_list
...
...
@@ -886,6 +884,8 @@ class ZCatalog(Folder, Persistent, Implicit):
priority
=
archive
.
getPriority
()).
uncatalog_object
(
uid
=
uid
,
path
=
path
,
sql_catalog_id
=
catalog_id
)
catalog_id_list
=
self
.
getERP5CatalogIdList
()
for
sql_catalog_id
in
catalog_id_list
:
catalog
=
self
.
getSQLCatalog
(
sql_catalog_id
)
if
catalog
is
not
None
:
catalog
.
uncatalogObject
(
uid
=
uid
,
path
=
path
)
...
...
@@ -901,6 +901,8 @@ class ZCatalog(Folder, Persistent, Implicit):
security
.
declarePrivate
(
'beforeUncatalogObject'
)
def
beforeUncatalogObject
(
self
,
uid
=
None
,
path
=
None
,
sql_catalog_id
=
None
):
""" wrapper around catalog """
catalog_id_list
=
self
.
getERP5CatalogIdList
()
for
sql_catalog_id
in
catalog_id_list
:
catalog
=
self
.
getSQLCatalog
(
sql_catalog_id
)
if
catalog
is
not
None
:
catalog
.
beforeUncatalogObject
(
uid
=
uid
,
path
=
path
)
...
...
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