Last change
on this file since 1239 was
1239,
checked in by mylan, 15 years ago
|
Moved conditional adding IPossibleWeblogEntry to Document objects on adding it in the weblog, based on content rules and workflow transition. Tests updated
|
File size:
810 bytes
|
Line | |
---|
1 | # |
---|
2 | # PATCH DEFERRED CONTENT RULE EXECUTION ON ADDING AT OBJECTS |
---|
3 | # |
---|
4 | # this behavior not suite for testing quills because of |
---|
5 | # in tests it uses addEntry method, which perform adding |
---|
6 | # blog post with only one invokeFactory method without |
---|
7 | # following steps (performed in TTW plone operation) |
---|
8 | # |
---|
9 | |
---|
10 | from plone.app.contentrules import handlers as pcrh |
---|
11 | def patched_added(event): |
---|
12 | """When an object is added, execute rules assigned to its new parent. |
---|
13 | |
---|
14 | There is special handling for Archetypes objects. |
---|
15 | """ |
---|
16 | if pcrh.is_portal_factory(event.object): |
---|
17 | return |
---|
18 | |
---|
19 | # The object added event executes too early for Archetypes objects. |
---|
20 | # We need to delay execution until we receive a subsequent IObjectInitializedEvent |
---|
21 | |
---|
22 | pcrh.init() |
---|
23 | pcrh.execute(event.newParent, event) |
---|
24 | |
---|
25 | pcrh.added = patched_added |
---|
Note: See
TracBrowser
for help on using the repository browser.