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
Carlos Ramos Carreño
erp5
Commits
0060f8ee
Commit
0060f8ee
authored
Mar 22, 2023
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
guard dynamically generated tester and preference methods.
parent
6a2c8eba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
16 deletions
+29
-16
product/ERP5Form/PreferenceTool.py
product/ERP5Form/PreferenceTool.py
+14
-0
product/ERP5Type/Accessor/Accessor.py
product/ERP5Type/Accessor/Accessor.py
+15
-0
product/ERP5Type/Accessor/Base.py
product/ERP5Type/Accessor/Base.py
+0
-16
No files found.
product/ERP5Form/PreferenceTool.py
View file @
0060f8ee
...
...
@@ -88,6 +88,20 @@ class PreferenceMethod(Method):
cache_factory
=
'erp5_ui_long'
)
return
_getPreference
(
default
,
*
args
,
**
kw
)
class
__roles__
:
@
staticmethod
def
rolesForPermissionOn
(
ob
):
self
=
ob
.
__self__
name
=
'%s__roles__'
%
ob
.
__name__
# we explictly call _aq_dynamic to prevent acquiering the attribute
# from container
roles
=
getattr
(
self
.
__class__
,
name
,
self
)
if
roles
is
self
:
roles
=
self
.
_aq_dynamic
(
name
)
if
roles
is
None
:
return
rolesForPermissionOn
(
None
,
self
,
(
'Manager'
,),
'_Access_contents_information_Permission'
)
return
getattr
(
roles
,
'__of__'
,
lambda
aq_parent
:
roles
)(
self
)
class
PreferenceTool
(
BaseTool
):
"""
...
...
product/ERP5Type/Accessor/Accessor.py
View file @
0060f8ee
...
...
@@ -66,3 +66,18 @@ class Accessor(Method):
# Returns a reindexing alias
from
.Alias
import
ReindexAlias
return
ReindexAlias
(
id
,
self
.
__name__
)
class
__roles__
:
@
staticmethod
def
rolesForPermissionOn
(
ob
):
self
=
ob
.
__self__
name
=
'%s__roles__'
%
ob
.
__name__
# we explictly call _aq_dynamic to prevent acquiering the attribute
# from container
roles
=
getattr
(
self
.
__class__
,
name
,
self
)
if
roles
is
self
:
roles
=
self
.
_aq_dynamic
(
name
)
if
roles
is
None
:
return
rolesForPermissionOn
(
None
,
self
,
(
'Manager'
,),
'_Access_contents_information_Permission'
)
return
getattr
(
roles
,
'__of__'
,
lambda
aq_parent
:
roles
)(
self
)
product/ERP5Type/Accessor/Base.py
View file @
0060f8ee
...
...
@@ -187,22 +187,6 @@ class Getter(Method):
psyco
.
bind
(
__call__
)
class
__roles__
:
@
staticmethod
def
rolesForPermissionOn
(
ob
):
self
=
ob
.
__self__
name
=
'%s__roles__'
%
ob
.
__name__
# we explictly call _aq_dynamic to prevent acquiering the attribute
# from container
roles
=
getattr
(
self
.
__class__
,
name
,
self
)
if
roles
is
self
:
roles
=
self
.
_aq_dynamic
(
name
)
if
roles
is
None
:
return
rolesForPermissionOn
(
None
,
self
,
(
'Manager'
,),
'_Access_contents_information_Permission'
)
return
getattr
(
roles
,
'__of__'
,
lambda
aq_parent
:
roles
)(
self
)
class
Tester
(
Method
):
"""
Tests if an attribute value exists
...
...
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