Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
51cdfe069e10
Commit
49d389e0
authored
Aug 20, 2009
by
Sylvain Thénault
Browse files
fix edited_attributes handling when adding entity
--HG-- branch : stable
parent
edfdb69df6e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/repository.py
View file @
51cdfe06
...
...
@@ -996,15 +996,16 @@ class Repository(object):
print
'ADD entity'
,
etype
,
entity
.
eid
,
dict
(
entity
)
entity
.
_is_saved
=
False
# entity has an eid but is not yet saved
relations
=
[]
# if inlined relations are specified, fill entity's related cache to
# avoid unnecessary queries
# init edited_attributes before calling before_add_entity hooks
entity
.
edited_attributes
=
set
(
entity
)
if
source
.
should_call_hooks
:
self
.
hm
.
call_hooks
(
'before_add_entity'
,
etype
,
session
,
entity
)
# XXX use entity.keys here since edited_attributes is not updated for
# inline relations
for
attr
in
entity
.
keys
():
rschema
=
eschema
.
subject_relation
(
attr
)
if
not
rschema
.
is_final
():
# inlined relation
relations
.
append
((
attr
,
entity
[
attr
]))
if
source
.
should_call_hooks
:
self
.
hm
.
call_hooks
(
'before_add_entity'
,
etype
,
session
,
entity
)
entity
.
edited_attributes
=
set
(
entity
)
entity
.
set_defaults
()
entity
.
check
(
creation
=
True
)
source
.
add_entity
(
session
,
entity
)
...
...
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