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
Titouan Soulard
erp5
Commits
ee4588fd
Commit
ee4588fd
authored
Mar 19, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Variable.py: add attributes and fonctions in class Variable.
parent
96b7845c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
product/ERP5Workflow/Document/Variable.py
product/ERP5Workflow/Document/Variable.py
+70
-0
No files found.
product/ERP5Workflow/Document/Variable.py
View file @
ee4588fd
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.ERP5Type.XMLObject
import
XMLObject
from
Products.DCWorkflow.Guard
import
Guard
from
Products.CMFCore.Expression
import
Expression
class
Variable
(
XMLObject
):
class
Variable
(
XMLObject
):
"""
"""
...
@@ -41,6 +43,15 @@ class Variable(XMLObject):
...
@@ -41,6 +43,15 @@ class Variable(XMLObject):
isPortalContent
=
1
isPortalContent
=
1
isRADContent
=
1
isRADContent
=
1
info_guard
=
None
description
=
''
for_catalog
=
1
for_status
=
1
default_value
=
''
default_expr
=
None
# Overrides default_value if set
info_guard
=
None
update_always
=
1
# Declarative security
# Declarative security
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
...
@@ -53,3 +64,62 @@ class Variable(XMLObject):
...
@@ -53,3 +64,62 @@ class Variable(XMLObject):
PropertySheet
.
DublinCore
,
PropertySheet
.
DublinCore
,
PropertySheet
.
Variable
,
PropertySheet
.
Variable
,
)
)
def
getDefaultExprText
(
self
):
if
not
self
.
default_expr
:
return
''
else
:
return
self
.
default_expr
.
text
def
generateInfoGuard
(
self
):
if
self
.
info_guard
==
None
:
self
.
info_guard
=
Guard
(
permissions
=
self
.
getPermissionList
(),
roles
=
self
.
getRoleList
(),
groups
=
self
.
getGroupList
(),
expr
=
self
.
getExpression
())
if
self
.
info_guard
.
roles
!=
self
.
getRoleList
():
self
.
info_guard
.
roles
=
self
.
getRoleList
()
elif
self
.
info_guard
.
permissions
!=
self
.
getPermissionList
():
self
.
info_guard
.
permissions
=
self
.
getPermissionList
()
elif
self
.
info_guard
.
groups
!=
self
.
getGroupList
():
self
.
info_guard
.
groups
=
self
.
getGroupList
()
elif
self
.
info_guard
.
expr
!=
self
.
getExpression
():
self
.
info_guard
.
expr
=
self
.
getExpression
()
def
getInfoGuard
(
self
):
if
self
.
info_guard
is
not
None
:
return
self
.
info_guard
else
:
return
Guard
().
__of__
(
self
)
# Create a temporary guard.
def
getInfoGuardSummary
(
self
):
res
=
None
if
self
.
info_guard
is
not
None
:
res
=
self
.
info_guard
.
getSummary
()
return
res
def
setProperties
(
self
,
description
,
default_value
=
''
,
default_expr
=
''
,
for_catalog
=
0
,
for_status
=
0
,
update_always
=
0
,
props
=
None
,
REQUEST
=
None
):
'''
'''
self
.
description
=
str
(
description
)
self
.
default_value
=
str
(
default_value
)
if
default_expr
:
self
.
default_expr
=
Expression
(
default_expr
)
else
:
self
.
default_expr
=
None
g
=
Guard
()
if
g
.
changeFromProperties
(
props
or
REQUEST
):
self
.
info_guard
=
g
else
:
self
.
info_guard
=
None
self
.
for_catalog
=
bool
(
for_catalog
)
self
.
for_status
=
bool
(
for_status
)
self
.
update_always
=
bool
(
update_always
)
if
REQUEST
is
not
None
:
return
self
.
manage_properties
(
REQUEST
,
'Properties changed.'
)
\ No newline at end of file
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