Ticket #7385 (closed Bug: fixed)
content rules fail when creating content types.
| Reported by: | regebro | Owned by: | optilude |
|---|---|---|---|
| Priority: | minor | Milestone: | 3.1 |
| Component: | Content Rules | Keywords: | |
| Cc: | regebro@… |
Description
If you have a content type that filters on portal type, it will look for getTypeInfo on the object and call it to see what portal type is is.
However, when you add something under portal_types, it will find the getTypeInfo method of the TypesTool, which requires a parameter. The subsequent call to getTypeInfo will fail with a type error.
There are two possible solutions.
1: Replace line 68 in plone.app.contentrules.conditions.portaltype with
try:
return getTypeInfo().getId() in self.element.check_types
except TypeError:
# We added an object under portal_types. return False
2: Change line 65 from:
getTypeInfo = getattr(aq_inner(self.event.object), 'getTypeInfo', None)
to
getTypeInfo = getattr(aq_base(self.event.object), 'getTypeInfo', None)
to prevent acquisition of getTypeInfo. But that may have other side effects.

Lennart,
Are you seeing invocation of content rules on an FTI object created in portal_types? That's a bit strange - they should only be enabled for contentish objects.
In any case, +1 for option 2 - I don't see a use case for acquiring getTypeInfo().