Discussion:
[Erp5-dev] allowed content type has None values
Jacek Medrzycki
2007-05-24 15:54:23 UTC
Permalink
Hi

Today I have upgraded rather old site (february/march) and I 've got the
following error while trying to display documents:

* Module Products.ERP5Type.patches.CMFBTreeFolder, line 53, in
CMFBTreeFolder_allowedContentTypes
* Module Products.ERP5Type.patches.CMFBTreeFolder, line 52, in <lambda>

AttributeError: 'NoneType' object has no attribute 'isConstructionAllowed'


I have found that in Products.ERP5Type.patches.CMFBTreeFolder, in
CMFBTreeFolder_allowedContentTypes, the list of portal types contains
None value, so the filter fails on typ.isConstructionAllowed(...)

I've made small (and rather ugly ;) patch that filters out None value,
and the site appears to work after applying this. However, I don't know
why allowed content type list contains None. Is it becouse of the old
site I had, or something is broken in ERP5? Did anybody have similar
symptoms?

Regards, Jacek

the patch:
Index: CMFBTreeFolder.py
===================================================================
--- CMFBTreeFolder.py (revision 14597)
+++ CMFBTreeFolder.py (working copy)
@@ -51,7 +51,7 @@

return filter( lambda typ, container=self:
typ.isConstructionAllowed( container )
- , result )
+ , filter(lambda typ: typ is not None,result) )
Romain Courteaud
2007-05-24 16:12:45 UTC
Permalink
Hello Jacek,

This issue was already discussed some days ago.
http://article.gmane.org/gmane.comp.python.zope.erp5.devel/1023

The issue comes from a wrong portal type configuration, which raise a
error in CMFBTreeFolder.

Generally speaking, it's good to raise error in the system if something
is wrong, so, CMFBTreeFolder will not be modified to catch this issue.
But it can be changed to raise another kind of order in order to fix the
issue more easily.

What is more important is to find why your portal type was in a bad
configuration state. One possibility is a bad Business Template
configuration.

Romain
Post by Jacek Medrzycki
Hi
Today I have upgraded rather old site (february/march) and I 've got the
* Module Products.ERP5Type.patches.CMFBTreeFolder, line 53, in
CMFBTreeFolder_allowedContentTypes
* Module Products.ERP5Type.patches.CMFBTreeFolder, line 52, in <lambda>
AttributeError: 'NoneType' object has no attribute 'isConstructionAllowed'
I have found that in Products.ERP5Type.patches.CMFBTreeFolder, in
CMFBTreeFolder_allowedContentTypes, the list of portal types contains
None value, so the filter fails on typ.isConstructionAllowed(...)
I've made small (and rather ugly ;) patch that filters out None value,
and the site appears to work after applying this. However, I don't know
why allowed content type list contains None. Is it becouse of the old
site I had, or something is broken in ERP5? Did anybody have similar
symptoms?
Regards, Jacek
Index: CMFBTreeFolder.py
===================================================================
--- CMFBTreeFolder.py (revision 14597)
+++ CMFBTreeFolder.py (working copy)
@@ -51,7 +51,7 @@
typ.isConstructionAllowed( container )
- , result )
+ , filter(lambda typ: typ is not None,result) )
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
http://erp5.org/mailman/listinfo/erp5-dev
Jérôme Perrin
2007-05-24 16:17:38 UTC
Permalink
Post by Jacek Medrzycki
I have found that in Products.ERP5Type.patches.CMFBTreeFolder, in
CMFBTreeFolder_allowedContentTypes, the list of portal types contains
None value, so the filter fails on typ.isConstructionAllowed(...)
I've made small (and rather ugly ;) patch that filters out None value,
and the site appears to work after applying this. However, I don't know
why allowed content type list contains None. Is it becouse of the old
site I had, or something is broken in ERP5? Did anybody have similar
symptoms?
Yes, this happen if a type information A has in it's allowed_content_type a
type information B, but B does not exists in types tool
(ie /erp5/portal_types). For instance
http://svn.erp5.org/?view=rev&revision=14164 was to solve this problem.

This is a bug, but we keep this bug in the development branch for a while so
that developers have to fix misconfigurations on business templates ;)

J?rome
Jacek Medrzycki
2007-05-25 10:13:15 UTC
Permalink
Post by Jérôme Perrin
Yes, this happen if a type information A has in it's allowed_content_type a
type information B, but B does not exists in types tool
(ie /erp5/portal_types). For instance
http://svn.erp5.org/?view=rev&revision=14164 was to solve this problem.
Thank You (and Romain too) for replay.
I've re-saved errornous portal types and that fixed the problem.

J.

Loading...