[Zope3-Users] Iteration over non-sequenze

Florian Lindner mailinglists at xgm.de
Thu Feb 17 10:20:51 EST 2005


Hello,
I'm using the lates SVN Zope 3 version. I've created a very simple product,
just consists of a schema with some fields and a folderish object.
When I try to create the folder object I get:

------
2005-02-17T12:07:19 ERROR SiteError http://horus.local:8080/@@contents.html
Traceback (most recent call last):
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/publisher/publish.py",
line 138, in publish
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/publication/zopepublication.py",
line 155, in callObject
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/publisher/publish.py",
line 113, in mapply
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/publisher/publish.py",
line 119, in debug_call
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/pagetemplate/viewpagetemplatefile.py",
line 80, in __call__
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/pagetemplate/viewpagetemplatefile.py",
line 49, in __call__
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/pagetemplate/pagetemplate.py",
line 120, in pt_render
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 240, in __call__
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 315, in interpret
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 804, in do_useMacro
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 315, in interpret
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 502, in do_optTag_tal
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 487, in do_optTag
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 482, in no_tag
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 315, in interpret
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 774, in do_defineMacro
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 315, in interpret
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 876, in do_defineSlot
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 315, in interpret
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 866, in do_defineSlot
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 315, in interpret
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 774, in do_defineMacro
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 315, in interpret
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tal/talinterpreter.py",
line 552, in do_setLocal_tal
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tales/tales.py", line
698, in evaluate
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tales/expressions.py",
line 204, in __call__
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/tales/expressions.py",
line 198, in _eval
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/container/browser/contents.py",
line 80, in listContentInfo
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/container/browser/contents.py",
line 246, in addObject
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/container/browser/adding.py",
line 157, in action
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/container/browser/adding.py",
line 72, in add
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/folder/folder.py",
line 98, in __setitem__
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/container/contained.py",
line 585, in setitem
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/event/__init__.py",
line 23, in notify
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/event/dispatching.py",
line 65, in dispatch
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/component/__init__.py",
line 178, in subscribers
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/component/site.py",
line 85, in subscribers
    sys.path[:] = L
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/interface/adapter.py",
line 468, in subscribers
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/event/objectevent.py",
line 76, in objectEventNotify
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/component/__init__.py",
line 178, in subscribers
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/component/site.py",
line 85, in subscribers
    sys.path[:] = L
  File "/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/interface/adapter.py",
line 468, in subscribers
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/container/contained.py",
line 176, in dispatchToSublocations
  File
"/home/florian/Desktop/Zope3-SVN/Zope3/src/zope/app/container/contained.py",
line 207, in sublocations
TypeError: iteration over non-sequence



It works with another object, which is almost identical. Although I've
compared the sources of the two several times I've found no significant
diffence. I think it's a very stupid mistake somewhere, but I don't know
where.
My configure.zcml:

<configure xmlns="http://namespaces.zope.org/zope">
 <include package=".browser" /> -->

    <interface interface=".interfaces.ILinkFolder"
type="zope.app.content.interfaces.IContentType" />
    <content class=".link.LinkFolder">
        <implements
interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
        <implements
interface="zope.app.container.interfaces.IContentContainer" />
        <implements
interface="zope.app.container.interfaces.IContainerNamesContainer" />
        <factory description="CS LinkFolder"/>
        <require permission="zope.Public"
interface=".interfaces.ILinkFolder" />
        <require permission="zope.Public"
set_schema=".interfaces.ILinkFolder" />
    </content>

    <interface interface=".interfaces.ILink"
type="zope.app.content.interfaces.IContentType" />
    <content class=".link.Link">
        <implements
interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
        <factory description="CS Link"/>
        <require permission="zope.Public" interface=".interfaces.ILink" />
        <require permission="zope.Public" set_schema=".interfaces.ILink" />
    </content>

</configure>

With a interfaces.py:


from zope.interface import Interface
from zope.app.container.interfaces import IContainer, IContained
from zope.schema import TextLine, Text, Field
from zope.app.container.constraints import ItemTypePrecondition,
ContainerTypesConstraint


class ILink(Interface):
    """This interface stores information about a URL."""

    def __setitem__(name, object):
        """Add a ILink object."""

    name = TextLine(
        title = u"Name",
        description = u"Short name",
        # default = u"",
        required = False)

    description = Text (
        title = u"Description",
        description = u"Longer description of the link",
        #default = u"",
        required = False)

    URL = Text (
        title = u"URL",
        description = u"The URL.",
        #default = u"",
        required = True)




class ILinkFolder(IContainer):
    def __setitem__(name, object):
        """Adds a ILinkFolder object."""

    __setitem__.precondition = ItemTypePrecondition(ILink)


class ILinkContained(IContained):
    __parent__ = Field( constraint = ContainerTypesConstraint(ILinkFolder))


What is wrong there? If you need more code, I would be happy to provide it...
Thanks for help.

Florian


More information about the Zope3-users mailing list