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
3ae7d5d9
Commit
3ae7d5d9
authored
Oct 02, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZSQLCatalog: Add getter and setter for default_sql_catalog_id in CatalogTool
parent
d1a6b249
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
11 deletions
+18
-11
product/ERP5Catalog/CatalogTool.py
product/ERP5Catalog/CatalogTool.py
+1
-1
product/ERP5Catalog/Tool/ArchiveTool.py
product/ERP5Catalog/Tool/ArchiveTool.py
+1
-1
product/ERP5Catalog/tests/testERP5Catalog.py
product/ERP5Catalog/tests/testERP5Catalog.py
+1
-1
product/ZSQLCatalog/ZSQLCatalog.py
product/ZSQLCatalog/ZSQLCatalog.py
+15
-8
No files found.
product/ERP5Catalog/CatalogTool.py
View file @
3ae7d5d9
...
...
@@ -369,7 +369,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
if
id
is
None
:
# Check if we want to use an archive
#if getattr(aq_base(self.portal_preferences), 'uid', None) is not None:
archive_path
=
self
.
portal_preferences
.
getPreferredArchive
(
sql_catalog_id
=
self
.
default_sql_catalog_id
)
archive_path
=
self
.
portal_preferences
.
getPreferredArchive
(
sql_catalog_id
=
self
.
getDefaultSqlCatalogId
()
)
if
archive_path
not
in
(
''
,
None
):
try
:
archive
=
self
.
restrictedTraverse
(
archive_path
)
...
...
product/ERP5Catalog/Tool/ArchiveTool.py
View file @
3ae7d5d9
...
...
@@ -78,7 +78,7 @@ class ArchiveTool(BaseTool):
"""
Return the archive used for the current catalog
"""
current_catalog
=
self
.
portal_catalog
.
default_sql_catalog_id
current_catalog
=
self
.
portal_catalog
.
getDefaultSqlCatalogId
()
current_archive_list
=
[
x
.
getObject
()
for
x
in
self
.
searchFolder
(
validation_state
=
"validated"
)
\
if
x
.
getCatalogId
()
==
current_catalog
]
if
len
(
current_archive_list
)
==
0
:
...
...
product/ERP5Catalog/tests/testERP5Catalog.py
View file @
3ae7d5d9
...
...
@@ -115,7 +115,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
def
beforeTearDown
(
self
):
# restore default_catalog
self
.
portal
.
portal_catalog
.
default_sql_catalog_id
=
'erp5_mysql_innodb'
self
.
portal
.
portal_catalog
.
_setDefaultSqlCatalogId
(
'erp5_mysql_innodb'
)
self
.
portal
.
portal_catalog
.
hot_reindexing_state
=
None
# clear Modules
for
module
in
[
self
.
getPersonModule
(),
...
...
product/ZSQLCatalog/ZSQLCatalog.py
View file @
3ae7d5d9
...
...
@@ -197,19 +197,26 @@ class ZCatalog(Folder, Persistent, Implicit):
def
getSQLCatalogIdList
(
self
):
return
self
.
objectIds
(
spec
=
(
'SQLCatalog'
,))
def
getDefaultSqlCatalogId
(
self
):
return
self
.
default_sql_catalog_id
def
_setDefaultSqlCatalogId
(
self
,
value
):
if
value
:
self
.
default_sql_catalog_id
=
value
security
.
declarePublic
(
'getSQLCatalog'
)
def
getSQLCatalog
(
self
,
id
=
None
,
default_value
=
None
):
"""
Get the default SQL Catalog.
"""
if
id
is
None
:
if
not
self
.
default_sql_catalog_id
:
if
not
self
.
getDefaultSqlCatalogId
()
:
id_list
=
self
.
getSQLCatalogIdList
()
if
len
(
id_list
)
>
0
:
self
.
default_sql_catalog_id
=
id_list
[
0
]
self
.
_setDefaultSqlCatalogId
(
id_list
[
0
])
else
:
return
default_value
id
=
self
.
default_sql_catalog_id
id
=
self
.
getDefaultSqlCatalogId
()
return
self
.
_getOb
(
id
,
default_value
)
...
...
@@ -256,7 +263,7 @@ class ZCatalog(Folder, Persistent, Implicit):
"""
#LOG("_setHotReindexingState call", 300, state)
if
source_sql_catalog_id
is
None
:
source_sql_catalog_id
=
self
.
default_sql_catalog_id
source_sql_catalog_id
=
self
.
getDefaultSqlCatalogId
()
if
state
==
HOT_REINDEXING_FINISHED_STATE
:
self
.
hot_reindexing_state
=
None
...
...
@@ -283,7 +290,7 @@ class ZCatalog(Folder, Persistent, Implicit):
current_archive
=
self
.
portal_archives
.
getCurrentArchive
()
else
:
current_archive
=
None
default_catalog_id
=
self
.
default_sql_catalog_id
default_catalog_id
=
self
.
getDefaultSqlCatalogId
()
self
.
_exchangeDatabases
(
source_sql_catalog_id
=
source_sql_catalog_id
,
destination_sql_catalog_id
=
destination_sql_catalog_id
,
skin_selection_dict
=
skin_selection_dict
,
...
...
@@ -381,8 +388,8 @@ class ZCatalog(Folder, Persistent, Implicit):
"""
Exchange two databases.
"""
if
self
.
default_sql_catalog_id
==
source_sql_catalog_id
:
self
.
default_sql_catalog_id
=
destination_sql_catalog_id
if
self
.
getDefaultSqlCatalogId
()
==
source_sql_catalog_id
:
self
.
_setDefaultSqlCatalogId
(
destination_sql_catalog_id
)
id_tool
=
getattr
(
self
.
getPortalObject
(),
'portal_ids'
,
None
)
if
id_tool
is
None
:
# Insert the latest generated uid.
...
...
@@ -453,7 +460,7 @@ class ZCatalog(Folder, Persistent, Implicit):
' you want to do is a "clear catalog" and an '
\
'"ERP5Site_reindexAll".'
if
source_sql_catalog_id
!=
self
.
default_sql_catalog_id
:
if
source_sql_catalog_id
!=
self
.
getDefaultSqlCatalogId
()
:
LOG
(
'ZSQLCatalog'
,
0
,
'Warning : Hot reindexing is started with a '
\
'source catalog which is not the default one.'
)
...
...
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