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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
erp5
Commits
66cb9c96
Commit
66cb9c96
authored
Mar 31, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make newContent call _edit sooner (before computing local roles)
parent
7f7cc0cf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
20 deletions
+7
-20
product/ERP5Type/Core/Folder.py
product/ERP5Type/Core/Folder.py
+2
-15
product/ERP5Type/ERP5Type.py
product/ERP5Type/ERP5Type.py
+5
-5
No files found.
product/ERP5Type/Core/Folder.py
View file @
66cb9c96
...
@@ -112,9 +112,7 @@ class FolderMixIn(ExtensionClass.Base):
...
@@ -112,9 +112,7 @@ class FolderMixIn(ExtensionClass.Base):
security
.
declarePublic
(
'newContent'
)
security
.
declarePublic
(
'newContent'
)
def
newContent
(
self
,
id
=
None
,
portal_type
=
None
,
id_group
=
None
,
def
newContent
(
self
,
id
=
None
,
portal_type
=
None
,
id_group
=
None
,
default
=
None
,
method
=
None
,
container
=
None
,
created_by_builder
=
0
,
default
=
None
,
method
=
None
,
container
=
None
,
temp_object
=
0
,
**
kw
):
activate_kw
=
None
,
is_indexable
=
None
,
temp_object
=
0
,
reindex_kw
=
None
,
compute_local_role
=
None
,
notify_workflow
=
True
,
**
kw
):
"""Creates a new content.
"""Creates a new content.
This method is public, since TypeInformation.constructInstance will perform
This method is public, since TypeInformation.constructInstance will perform
the security check.
the security check.
...
@@ -157,21 +155,10 @@ class FolderMixIn(ExtensionClass.Base):
...
@@ -157,21 +155,10 @@ class FolderMixIn(ExtensionClass.Base):
new_instance
=
type_info
.
constructInstance
(
new_instance
=
type_info
.
constructInstance
(
container
=
container
,
container
=
container
,
id
=
new_id
,
id
=
new_id
,
created_by_builder
=
created_by_builder
,
temp_object
=
temp_object
or
temp_container
,
temp_object
=
temp_object
or
temp_container
,
activate_kw
=
activate_kw
,
**
kw
)
reindex_kw
=
reindex_kw
,
is_indexable
=
is_indexable
,
compute_local_role
=
compute_local_role
,
notify_workflow
=
notify_workflow
,
)
# **kw) removed due to CMF bug
# TODO :the **kw makes it impossible to create content not based on
# ERP5TypeInformation, because factory method often do not support
# keywords arguments.
if
temp_container
:
if
temp_container
:
container
.
_setObject
(
new_id
,
new_instance
.
aq_base
)
container
.
_setObject
(
new_id
,
new_instance
.
aq_base
)
if
kw
:
new_instance
.
_edit
(
force_update
=
1
,
**
kw
)
return
new_instance
return
new_instance
security
.
declareProtected
(
security
.
declareProtected
(
...
...
product/ERP5Type/ERP5Type.py
View file @
66cb9c96
...
@@ -353,7 +353,7 @@ class ERP5TypeInformation(XMLObject,
...
@@ -353,7 +353,7 @@ class ERP5TypeInformation(XMLObject,
security
.
declarePublic
(
'constructInstance'
)
security
.
declarePublic
(
'constructInstance'
)
def
constructInstance
(
self
,
container
,
id
,
created_by_builder
=
0
,
def
constructInstance
(
self
,
container
,
id
,
created_by_builder
=
0
,
temp_object
=
0
,
compute_local_role
=
None
,
temp_object
=
0
,
compute_local_role
=
None
,
notify_workflow
=
True
,
*
args
,
**
kw
):
notify_workflow
=
True
,
*
*
kw
):
"""
"""
Build a "bare" instance of the appropriate type in
Build a "bare" instance of the appropriate type in
'container', using 'id' as its id.
'container', using 'id' as its id.
...
@@ -396,13 +396,13 @@ class ERP5TypeInformation(XMLObject,
...
@@ -396,13 +396,13 @@ class ERP5TypeInformation(XMLObject,
if
getattr
(
aq_base
(
ob
),
'uid'
,
None
)
is
None
:
if
getattr
(
aq_base
(
ob
),
'uid'
,
None
)
is
None
:
ob
.
uid
=
portal
.
portal_catalog
.
newUid
()
ob
.
uid
=
portal
.
portal_catalog
.
newUid
()
if
kw
:
ob
.
_edit
(
force_update
=
1
,
**
kw
)
# Portal type has to be set before setting other attributes
# Portal type has to be set before setting other attributes
# in order to initialize aq_dynamic
# in order to initialize aq_dynamic
ob
.
portal_type
=
self
.
getId
()
ob
.
portal_type
=
self
.
getId
()
if
kw
:
ob
.
_edit
(
force_update
=
1
,
**
kw
)
if
compute_local_role
:
if
compute_local_role
:
# Do not reindex object because it's already done by manage_afterAdd
# Do not reindex object because it's already done by manage_afterAdd
self
.
updateLocalRolesOnDocument
(
ob
,
reindex
=
False
)
self
.
updateLocalRolesOnDocument
(
ob
,
reindex
=
False
)
...
@@ -420,7 +420,7 @@ class ERP5TypeInformation(XMLObject,
...
@@ -420,7 +420,7 @@ class ERP5TypeInformation(XMLObject,
if
init_script
:
if
init_script
:
# Acquire the init script in the context of this object
# Acquire the init script in the context of this object
kw
[
'created_by_builder'
]
=
created_by_builder
kw
[
'created_by_builder'
]
=
created_by_builder
getattr
(
ob
,
init_script
)(
*
args
,
**
kw
)
getattr
(
ob
,
init_script
)()
return
ob
return
ob
...
...
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