this works without any error, comment_after_insert_listener() prints
that target.report.comments_count = 1, but this value isn't commited...
Can't get why prev testcase fails, this works,
but target.report.comments_count value isn't saved :/
def comment_after_insert_listener(mapper, connection, target):
target.report.comments_count = target.report.comments_count + 1
print target.report.comments_count
event.listen(Comment, 'after_insert', comment_after_insert_listener)
session = Session()
report = session.query(Report).get(1)
comment = Comment(content=u'test comment', report=report)
session.add(comment)
session.commit()
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sqlalchemy/-/7TouhhL3eSwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.