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
d22251af
Commit
d22251af
authored
Jun 29, 2011
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update comment. Explain original purpose of asContext.
parent
0ef6dda6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+6
-9
No files found.
product/ERP5Type/Base.py
View file @
d22251af
...
@@ -2560,8 +2560,10 @@ class Base( CopyContainer,
...
@@ -2560,8 +2560,10 @@ class Base( CopyContainer,
security
.
declarePublic
(
'asContext'
)
security
.
declarePublic
(
'asContext'
)
def
asContext
(
self
,
context
=
None
,
REQUEST
=
None
,
**
kw
):
def
asContext
(
self
,
context
=
None
,
REQUEST
=
None
,
**
kw
):
"""
"""
Allows to have a kind of temp copy of an object edited with kw
The purpose of asContext is to allow users overloading easily the properties and categories of
parameters. This is somewhat equivalent to use tempObject.
an existing persistent object. (Use the same data and create a different portal type instance)
Pay attention, to use asContext to create a temp object is wrong usage.
ex : joe_person = person_module.bob_person.asContext(first_name='Joe')
ex : joe_person = person_module.bob_person.asContext(first_name='Joe')
"""
"""
...
@@ -2578,13 +2580,8 @@ class Base( CopyContainer,
...
@@ -2578,13 +2580,8 @@ class Base( CopyContainer,
temp_object
=
True
,
temp_object
=
True
,
is_indexable
=
False
)
is_indexable
=
False
)
# Attention! Here all contents of self.__dict__ are
# Pass all internal data to new instance. Do not copy, but
# passed to context. This means that if self contains
# pass the same data. This is on purpose.
# persistent object, it may be modified through the context.
# And if context is cached on memory, ConnectionStateError
# may occur. Thus this is very dangerous code.
# If asContext is expected to return a copied temporary object,
# copy.deepcopy must be used here.
context
.
__dict__
.
update
(
self
.
__dict__
)
context
.
__dict__
.
update
(
self
.
__dict__
)
# Copy REQUEST properties to self
# Copy REQUEST properties to self
...
...
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