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
Frederic Thoma
erp5
Commits
cd6aed4f
Commit
cd6aed4f
authored
Feb 05, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix PortalTransform's usage of volatile attributes.
parent
e8667573
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
18 deletions
+15
-18
product/PortalTransforms/Transform.py
product/PortalTransforms/Transform.py
+10
-15
product/PortalTransforms/cache.py
product/PortalTransforms/cache.py
+5
-3
No files found.
product/PortalTransforms/Transform.py
View file @
cd6aed4f
...
...
@@ -142,6 +142,10 @@ class Transform(SimpleItem):
return
transform
def
_load_transform
(
self
):
try
:
return
self
.
_v_transform
except
AttributeError
:
pass
try
:
m
=
import_from_name
(
self
.
module
)
except
ImportError
,
err
:
...
...
@@ -179,16 +183,12 @@ class Transform(SimpleItem):
security
.
declarePublic
(
'get_documentation'
)
def
get_documentation
(
self
):
""" return transform documentation """
if
not
hasattr
(
self
,
'_v_transform'
):
self
.
_load_transform
()
return
self
.
_v_transform
.
__doc__
return
self
.
_load_transform
().
__doc__
security
.
declarePrivate
(
'convert'
)
def
convert
(
self
,
*
args
,
**
kwargs
):
""" return apply the transform and return the result """
if
not
hasattr
(
self
,
'_v_transform'
):
self
.
_load_transform
()
return
self
.
_v_transform
.
convert
(
*
args
,
**
kwargs
)
return
self
.
_load_transform
().
convert
(
*
args
,
**
kwargs
)
security
.
declarePublic
(
'name'
)
def
name
(
self
):
...
...
@@ -198,11 +198,7 @@ class Transform(SimpleItem):
security
.
declareProtected
(
ManagePortal
,
'get_parameters'
)
def
get_parameters
(
self
):
""" get transform's parameters names """
if
not
hasattr
(
self
,
'_v_transform'
):
self
.
_load_transform
()
keys
=
self
.
_v_transform
.
config
.
keys
()
keys
.
sort
()
return
keys
return
sorted
(
self
.
_load_transform
().
config
.
keys
())
security
.
declareProtected
(
ManagePortal
,
'get_parameter_value'
)
def
get_parameter_value
(
self
,
key
):
...
...
@@ -253,10 +249,9 @@ class Transform(SimpleItem):
# need to remap transform if necessary (i.e. configurable inputs / output)
if
kwargs
.
has_key
(
'inputs'
)
or
kwargs
.
has_key
(
'output'
):
tr_tool
.
_unmapTransform
(
self
)
if
not
hasattr
(
self
,
'_v_transform'
):
self
.
_load_transform
()
self
.
inputs
=
kwargs
.
get
(
'inputs'
,
self
.
_v_transform
.
inputs
)
self
.
output
=
kwargs
.
get
(
'output'
,
self
.
_v_transform
.
output
)
transform
=
self
.
_load_transform
()
self
.
inputs
=
kwargs
.
get
(
'inputs'
,
transform
.
inputs
)
self
.
output
=
kwargs
.
get
(
'output'
,
transform
.
output
)
tr_tool
.
_mapTransform
(
self
)
# track output encoding
if
kwargs
.
has_key
(
'output_encoding'
):
...
...
product/PortalTransforms/cache.py
View file @
cd6aed4f
...
...
@@ -33,9 +33,11 @@ class Cache:
return
obj
=
self
.
obj
key
=
self
.
_genCacheKey
(
key
)
if
getattr
(
aq_base
(
obj
),
self
.
_id
,
None
)
is
None
:
setattr
(
obj
,
self
.
_id
,
{})
getattr
(
obj
,
self
.
_id
)[
key
]
=
(
time
(),
value
)
entry
=
getattr
(
aq_base
(
obj
),
self
.
_id
,
None
)
if
entry
is
None
:
entry
=
{}
setattr
(
obj
,
self
.
_id
,
entry
)
entry
[
key
]
=
(
time
(),
value
)
return
key
def
getCache
(
self
,
key
):
...
...
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