Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
137
Merge Requests
137
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
3e5c5c52
Commit
3e5c5c52
authored
Jan 05, 2021
by
Aurel
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use queryUtility to look after the portal_membership
parent
2bead3b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
product/ERP5Type/Utils.py
product/ERP5Type/Utils.py
+15
-1
product/ERP5Type/dynamic/portal_type_class.py
product/ERP5Type/dynamic/portal_type_class.py
+7
-5
No files found.
product/ERP5Type/Utils.py
View file @
3e5c5c52
...
...
@@ -38,6 +38,7 @@ import sys
import
inspect
import
persistent
from
hashlib
import
md5
as
md5_new
,
sha1
as
sha_new
from
zope.component
import
queryUtility
from
Products.ERP5Type.Globals
import
package_home
from
Products.ERP5Type.Globals
import
DevelopmentMode
from
Acquisition
import
aq_base
...
...
@@ -57,6 +58,7 @@ from Products.CMFCore.utils import getToolByName
from
Products.PageTemplates.Expressions
import
getEngine
from
Products.PageTemplates.Expressions
import
SecureModuleImporter
from
Products.ZCatalog.Lazy
import
LazyMap
from
Products.CMFCore.interfaces
import
IMembershipTool
try
:
import
chardet
...
...
@@ -1244,6 +1246,18 @@ def initializeProduct( context,
ExpressionEngine
=
getEngine
()
CompilerError
=
ExpressionEngine
.
getCompilerError
()
def
migratePM
():
from
Products.CMFCore.MembershipTool
import
MembershipTool
tool
=
getattr
(
portal
,
"portal_membership"
,
None
)
if
tool
and
tool
.
__class__
is
not
MembershipTool
:
assert
not
tool
.
_p_changed
tool
.
__class__
=
MembershipTool
assert
tool
.
_p_changed
migrate
=
True
def
createExpressionContext
(
object
,
portal
=
None
):
"""
Return a context used for evaluating a TALES expression.
...
...
@@ -1271,7 +1285,7 @@ def createExpressionContext(object, portal=None):
folder
=
aq_parent
(
aq_inner
(
folder
))
if
portal
is
not
None
:
pm
=
getattr
(
portal
,
'portal_membership'
,
None
)
pm
=
queryUtility
(
IMembershipTool
)
if
pm
is
None
or
pm
.
isAnonymousUser
():
member
=
None
else
:
...
...
product/ERP5Type/dynamic/portal_type_class.py
View file @
3e5c5c52
...
...
@@ -261,8 +261,8 @@ def generatePortalTypeClass(site, portal_type_name):
accessor_holder_list
=
[]
if
portal_type_name
not
in
property_sheet_generating_portal_type_set
:
#
LOG("ERP5Type.dynamic", INFO,
#
"Filling accessor holder list for portal_type " + portal_type_name)
LOG
(
"ERP5Type.dynamic"
,
INFO
,
"Filling accessor holder list for portal_type "
+
portal_type_name
)
property_sheet_generating_portal_type_set
.
add
(
portal_type_name
)
try
:
...
...
@@ -383,7 +383,8 @@ def synchronizeDynamicModules(context, force=False):
and send out an invalidation to other nodes
"""
portal
=
context
.
getPortalObject
()
from
zLOG
import
LOG
LOG
(
"AUREL"
,
300
,
"syncDynamicModule"
)
global
last_sync
if
force
:
# hard invalidation to force sync between nodes
...
...
@@ -426,6 +427,7 @@ def synchronizeDynamicModules(context, force=False):
# some changes that are required for the migration.
if
portal
.
id
not
in
_bootstrapped
and
\
TransactionalResource
.
registerOnce
(
__name__
,
'bootstrap'
,
portal
.
id
):
LOG
(
"AUREL"
,
300
,
"will check for migration"
)
migrate
=
False
from
Products.ERP5Type.Tool.PropertySheetTool
import
PropertySheetTool
from
Products.ERP5Type.Tool.TypesTool
import
TypesTool
...
...
@@ -438,7 +440,7 @@ def synchronizeDynamicModules(context, force=False):
# (only likely to happen on the first run ever)
tool_id
=
tool_class
.
id
tool
=
getattr
(
portal
,
tool_id
,
None
)
LOG
(
"tool"
,
300
,
"%r"
%
(
tool
,))
if
tool
is
None
:
if
tool_class
==
ERP5CatalogTool
:
# Wait till we find that SQL Catalog Tool is installed
...
...
@@ -467,7 +469,7 @@ def synchronizeDynamicModules(context, force=False):
portal
.
portal_activities
.
initialize
()
except
AttributeError
:
pass
# no Activity Tool yet
LOG
(
"AUREL"
,
300
,
"fix MembershipTool"
)
from
Products.CMFCore.MembershipTool
import
MembershipTool
tool
=
getattr
(
portal
,
"portal_membership"
,
None
)
if
tool
and
tool
.
__class__
is
not
MembershipTool
:
...
...
Aurel
@aurel
mentioned in commit
31e3a7e5
·
Jan 05, 2021
mentioned in commit
31e3a7e5
mentioned in commit 31e3a7e511b0022c68fa38bde7fc80ce14522743
Toggle commit list
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