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
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
bcb43861
Commit
bcb43861
authored
Oct 20, 2020
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5{,Type}: Implement skinSuper at ERP5Site level.
Portal is the Skinnable object, skin magic belongs there.
parent
b3fa0428
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
14 deletions
+17
-14
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+16
-1
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+1
-13
No files found.
product/ERP5/ERP5Site.py
View file @
bcb43861
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
Portal class
Portal class
"""
"""
import
threading
import
thread
,
thread
ing
from
weakref
import
ref
as
weakref
from
weakref
import
ref
as
weakref
from
OFS.Application
import
Application
,
AppInitializer
from
OFS.Application
import
Application
,
AppInitializer
from
Products.ERP5Type
import
Globals
from
Products.ERP5Type
import
Globals
...
@@ -33,6 +33,7 @@ from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
...
@@ -33,6 +33,7 @@ from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from
Products.ERP5Type.Cache
import
caching_instance_method
from
Products.ERP5Type.Cache
import
caching_instance_method
from
Products.ERP5Type.Cache
import
CachingMethod
,
CacheCookieMixin
from
Products.ERP5Type.Cache
import
CachingMethod
,
CacheCookieMixin
from
Products.ERP5Type.ERP5Type
import
ERP5TypeInformation
from
Products.ERP5Type.ERP5Type
import
ERP5TypeInformation
from
Products.ERP5Type.patches.CMFCoreSkinnable
import
SKINDATA
,
skinResolve
from
Products.CMFActivity.Errors
import
ActivityPendingError
from
Products.CMFActivity.Errors
import
ActivityPendingError
import
ERP5Defaults
import
ERP5Defaults
from
Products.ERP5Type.TransactionalVariable
import
getTransactionalVariable
from
Products.ERP5Type.TransactionalVariable
import
getTransactionalVariable
...
@@ -409,6 +410,20 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, CMFSite, CacheCookieMixin):
...
@@ -409,6 +410,20 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, CMFSite, CacheCookieMixin):
return
self
return
self
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'skinSuper'
)
def
skinSuper
(
self
,
skin
,
id
):
if
id
[:
1
]
!=
'_'
and
id
[:
3
]
!=
'aq_'
:
skin_info
=
SKINDATA
.
get
(
thread
.
get_ident
())
if
skin_info
is
not
None
:
_
,
skin_selection_name
,
_
,
_
=
skin_info
skin_value
=
skinResolve
(
self
,
(
skin_selection_name
,
skin
),
id
)
if
skin_value
is
not
None
:
# Wrap at the portal to set the owner of the executing script.
# This mimics the usual way to get an object from skin folders,
# and it's required when 'skin_value' is a script with proxy roles.
return
skin_value
.
__of__
(
self
)
raise
AttributeError
(
id
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'isDeletable'
)
'isDeletable'
)
def
isDeletable
(
self
,
check_relation
):
def
isDeletable
(
self
,
check_relation
):
...
...
product/ERP5Type/Base.py
View file @
bcb43861
...
@@ -61,7 +61,6 @@ from Products.ERP5Type import _dtmldir
...
@@ -61,7 +61,6 @@ from Products.ERP5Type import _dtmldir
from
Products.ERP5Type
import
PropertySheet
from
Products.ERP5Type
import
PropertySheet
from
Products.ERP5Type
import
interfaces
from
Products.ERP5Type
import
interfaces
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.patches.CMFCoreSkinnable
import
SKINDATA
,
skinResolve
from
Products.ERP5Type.Utils
import
UpperCase
from
Products.ERP5Type.Utils
import
UpperCase
from
Products.ERP5Type.Utils
import
convertToUpperCase
,
convertToMixedCase
from
Products.ERP5Type.Utils
import
convertToUpperCase
,
convertToMixedCase
from
Products.ERP5Type.Utils
import
createExpressionContext
,
simple_decorator
from
Products.ERP5Type.Utils
import
createExpressionContext
,
simple_decorator
...
@@ -3086,18 +3085,7 @@ class Base(
...
@@ -3086,18 +3085,7 @@ class Base(
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'skinSuper'
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'skinSuper'
)
def
skinSuper
(
self
,
skin
,
id
):
def
skinSuper
(
self
,
skin
,
id
):
if
id
[:
1
]
!=
'_'
and
id
[:
3
]
!=
'aq_'
:
return
self
.
getPortalObject
().
skinSuper
(
skin
,
id
).
__of__
(
self
)
skin_info
=
SKINDATA
.
get
(
thread
.
get_ident
())
if
skin_info
is
not
None
:
portal
=
self
.
getPortalObject
()
_
,
skin_selection_name
,
_
,
_
=
skin_info
object
=
skinResolve
(
portal
,
(
skin_selection_name
,
skin
),
id
)
if
object
is
not
None
:
# First wrap at the portal to set the owner of the executing script.
# This mimics the usual way to get an object from skin folders,
# and it's required when 'object' is an script with proxy roles.
return
object
.
__of__
(
portal
).
__of__
(
self
)
raise
AttributeError
(
id
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'get_local_permissions'
)
'get_local_permissions'
)
...
...
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