[Zope3-Users] Weird error for a certain named attribute
Tom Dossis
td at yoma.com.au
Thu Oct 18 16:54:34 EDT 2007
On 18/10/2007, at 11:58 PM, Maken Seteva wrote:
> Hello,
> I have a very strange error that I cannot understand. I get an
> error for one of my attribute
> only when it is named a certain name! It seems like there is an
> old implementation of
> it that is haunting in the background, how is this possible?
>
> This cursed name is called "tags". This attribute is a list of
> TextLine. I get the error when I
> don't add anything to the list in the adding view:
>
> "TypeError: iteration over non-sequence"
>
>
> However, if I rename the attribute to "wehoo" or really, anything
> else, I don't get the TypeError and
> I can add my content object successfully (with an empty list for
> wehoo). Here's my component:
>
> class IFoo(IContained):
> #...
> tags = List(
> title=_(u'Tags'),
> description=_(u'A list of keywords'),
> max_length=10,
> value_type=TextLine(title=_(u'Tag')),
> unique=True
> )
> #...
>
>
> class Foo(Persistent):
> implements(IFoo)
> __name__ = __parent__ = None
> def __init__(self):
> #...
> self.tags = PersistentList()
> #...
>
> No custom widgets used for this field...
>
> I tried deleting all .pyc-files and deleting all old Foo objects,
> and the site i run for testing followed by
> restarting the server. But adding new Foo objects still don't work.
> (But renaming tags to anything else
> and then trying again will succeed).
>
> Any ideas?
Add: default=[] to your IFoo schema.
-Tom
More information about the Zope3-users
mailing list