Commit e2b14f57 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Add hot_ReindexAll action for ERP5 portal_catalog

parent 7b1e04cf
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_action</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>hot_reindex</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Hot ReindexAll</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/CatalogTool_hotReindexAll</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# Hot reindexing reindexes all documents using destination_sql_catalog_id
# with low priority (so site can keep working during hot reindexation).
REQUEST = context.REQUEST
source_sql_catalog_id = context.getSourceSqlCatalogId()
destination_sql_catalog_id = context.getDestinationSqlCatalogId()
return context.manage_hotReindexAll(source_sql_catalog_id = source_sql_catalog_id,
destination_sql_catalog_id = destination_sql_catalog_id,
REQUEST=REQUEST)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CatalogTool_hotReindexAll</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -75,10 +75,10 @@
<value>
<list>
<string>my_title</string>
<string>my_source_sql_catalog_id</string>
<string>my_destination_sql_catalog_id</string>
<string>my_hot_reindexing_state</string>
<string>my_archive_path</string>
<string>my_destination_sql_catalog_id</string>
<string>my_source_sql_catalog_id</string>
</list>
</value>
</item>
......
......@@ -43,6 +43,7 @@ Cache Factory | statistics
Cache Factory | view
Cache Tool | statistics
Cache Tool | view
Catalog Tool | hot_reindex
Catalog Tool | view
Catalog | catalog_filter_view
Catalog | clear_catalog
......
......@@ -184,4 +184,19 @@ class ERP5CatalogTool(BaseTool, CMFCore_CatalogTool):
def getCatalogUrl(self, object):
return self.__url(object)
def _redirectHotReindexAll(self, REQUEST, RESPONSE):
'''
Override this function from ZSQLCatalog as here we want to redirect to
the view for ERP5CatalogTool.
'''
if not RESPONSE:
try:
RESPONSE = REQUEST.RESPONSE
except AttributeError:
return
if RESPONSE is not None:
url = self.absolute_url() + '/view' \
+ '?portal_status_message=HotReindexing%20Started'
return RESPONSE.redirect(url)
InitializeClass(ERP5CatalogTool)
......@@ -541,7 +541,14 @@ class ZCatalog(Folder, Persistent, Implicit):
destination_sql_catalog_id=destination_sql_catalog_id,
skin_selection_dict=skin_selection_dict,
sql_connection_id_dict=sql_connection_id_dict)
if RESPONSE is not None:
self._redirectHotReindexAll(REQUEST, RESPONSE)
def _redirectHotReindexAll(self, REQUEST, RESPONSE):
'''
We need to separate the final redirection from manage_reindexAll to
remove the need of copy and patch for the ERP5CatalogTool.
'''
if RESPONE is not None:
URL1 = REQUEST.get('URL1')
RESPONSE.redirect(URL1 + '/manage_catalogHotReindexing?manage_tabs_message=HotReindexing%20Started')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment