[Zope3-Users] z3c.form and subforms in an AddForm?

Matt Bowen mrbowen at gmail.com
Wed Jul 4 12:59:23 EDT 2007


Hi again,

I now have all three forms giving me the component lookup error -- as you
sugguested, I changed zope.ManageContent to zope.Public; I'd rather have one
problem at a time. I also have a full traceback, because I realized that I
didn't include one last night:

zope.component.interfaces.ComponentLookupError:
((<z3c.pagelet.zcml.NextActionAddForm object at 0x2b69896b4850>, <
zope.publisher.browser.BrowserRequest instance URL=
http://localhost:9080/++skin++MovingTargetBrowser/addNextAction.html>, <
zope.app.folder.folder.Folder object at 0x2b69896eb0c8>), <InterfaceClass
z3c.form.interfaces.IWidgets>, u'')
> /opt/zope/zope-3.4.0a1
/lib/python/zope/component/_api.py(103)getMultiAdapter()
-> raise ComponentLookupError(objects, interface, name)
(Pdb)
Traceback (most recent call last):
  File "/opt/zope/python2.4//lib/python2.4/threading.py", line 422, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/opt/zope/zope-3.4.0a1/lib/python/twisted/python/threadpool.py",
line 148, in _worker
    context.call(ctx, function, *args, **kwargs)
  File "/opt/zope/zope-3.4.0a1/lib/python/twisted/python/context.py", line
59, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/opt/zope/zope-3.4.0a1/lib/python/twisted/python/context.py", line
37, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/opt/zope/zope-3.4.0a1/lib/python/twisted/web2/wsgi.py", line 198,
in run
    result = self.application(self.environment, self.startWSGIResponse)
  File "/opt/zope/zope-3.4.0a1/lib/python/zope/app/wsgi/__init__.py", line
72, in __call__
    return app.__call__(environ, start_response)
  File "/opt/zope/zope-3.4.0a1/lib/python/zope/app/wsgi/__init__.py", line
54, in __call__
    request = publish(request, handle_errors=handle_errors)
  File "/opt/zope/zope-3.4.0a1/lib/python/zope/publisher/publish.py", line
133, in publish
    result = publication.callObject(request, obj)
  File "/opt/zope/zope-3.4.0a1/lib/python/zope/app/publication/zopepublication.py",
line 161, in callObject
    return mapply(ob, request.getPositionalArguments(), request)
  File "/opt/zope/zope-3.4.0a1/lib/python/zope/publisher/publish.py", line
108, in mapply
    return debug_call(obj, args)
  File "/opt/zope/zope-3.4.0a1/lib/python/zope/publisher/publish.py", line
114, in debug_call
    return obj(*args)
  File "/opt/zope/python2.4/lib/python2.4/site-packages/z3c.form-
1.3.0-py2.4.egg/z3c/form/form.py", line 144, in __call__
    self.update()
  File "/opt/zope/python2.4/lib/python2.4/site-packages/z3c.form-
1.3.0-py2.4.egg/z3c/form/form.py", line 139, in update
    super(Form, self).update()
  File "/opt/zope/python2.4/lib/python2.4/site-packages/z3c.form-
1.3.0-py2.4.egg/z3c/form/form.py", line 88, in update
    self.updateWidgets()
  File "/opt/zope/python2.4/lib/python2.4/site-packages/z3c.form-
1.3.0-py2.4.egg/z3c/form/form.py", line 167, in updateWidgets
    self.widgets = zope.component.getMultiAdapter(
  File "/opt/zope/zope-3.4.0a1/lib/python/zope/component/_api.py", line 103,
in getMultiAdapter
    raise ComponentLookupError(objects, interface, name)
zope.component.interfaces.ComponentLookupError: ((<
z3c.pagelet.zcml.NextActionAddForm object at 0x2b69896b4850>, <
zope.publisher.browser.BrowserRequest instance URL=
http://localhost:9080/++skin++MovingTargetBrowser/addNextAction.html>, <
zope.app.folder.folder.Folder object at 0x2b69896eb0c8>), <InterfaceClass
z3c.form.interfaces.IWidgets>, u'')

I keep reading over the .txt files in z3c.form, and I feel like I may be
missing some line. Do I need a datamanager? My schema is pretty
straightforward:

from zope.interface import Interface
from zope.schema import Bool, Text, Datetime, TextLine

class INextAction(Interface):
    """Stores next actions, or the next physical
    thing a person can do for a project"""

    id = TextLine(
        title=u'ID',
        readonly=True,
        required=True)

    description = Text(
        title = u"Description",
        description = u"What is the next things you can physically do?",
        required = True
        )

    done = Bool(
        title = u"Done?",
        description = u"Is this Next Action complete?",
        required = False
        )

    due = Datetime(
        title = u"Due date.",
        description = u"When must this action be complete?",
        required = False
        )

Thanks again for all the advice; I feel like I'm making a little more
progress now :)

Gratefully,
Matt

On 7/4/07, Hermann Himmelbauer <dusty at qwer.tk> wrote:
>
> Am Mittwoch, 4. Juli 2007 00:33 schrieb Matt Bowen:
> > That was not at all a silly question! That got me a little closer -- I
> am
> > new enough not to have understood that i needed the ++skin++. Now,
> instead
> > of a 404 page, I get the following when I try to display my object:
> >
> > 127.0.0.1 - - [03/Jul/2007:18:26:54 -0400] "GET
> > /++skin++MovingTargetBrowser/viewguy/ HTTP/1.1" 500 131 "-" "Mozilla/5.0
> > (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.4) Gecko/20070515
> > Firefox/2.0.0.4"
> > zope.component.interfaces.ComponentLookupError:
> > ((<z3c.pagelet.zcml.NextActionDisplayForm object at 0x2aaaaaffb6d0>, <
> > zope.publisher.browser.BrowserRequest instance URL=
> > http://localhost:9080/++skin++MovingTargetBrowser/viewguy/index.html>, <
> > movingtarget.nextaction.NextAction object at 0x2adbcf6cd2a8>),
> > <InterfaceClass z3c.form.interfaces.IWidgets>, u'')
>
> This looks like some problem with widgets, I'm not sure. Such errors can
> be
> quite frustrating, I do it like this:
>
> - locate where the adapter is queried, this will be somewhere in the
> z3c.form
> package
> - If not sure, use "print 'HERE I AM'" statements in the source to find
> out
> where the exception is raised
> - When you found the code line, things hopefully resolve
> - Sometimes your object/request is not marked with the requested
> interface,
> you can check that out with a "print
> IRequestedInterface.providedBy(myobject)" in the framework source.
>
> I know that it is probably a bad style to temporarily modify the framework
> source but I can't think of a better solution.
>
> Over the time you'll start to "smell" why these component lookup errors
> happen
> and resolve them more easily.
>
> > And for edit, I get this:
> >
> > 127.0.0.1 - - [03/Jul/2007:18:30:30 -0400] "GET
> > /++skin++MovingTargetBrowser/viewguy/ HTTP/1.1" 500 201 "-" "Mozilla/5.0
> > (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.4) Gecko/20070515
> > Firefox/2.0.0.4"
> > zope.security.interfaces.Unauthorized:
> > (<z3c.pagelet.zcml.NextActionEditForm object at 0x2aaaaaf9dfd0>,
> > 'browserDefault', 'zope.ManageContent')
> >
> > > /opt/zope/zope-3.4.0a1
> >
> > /lib/python/zope/app/publication/browser.py(66)getDefaultTraversal()
> > -> return ob.browserDefault(request)
>
> Maybe you did not log in into the Zope instance? You set the permissions
> to "zope.ManageContent", you could also change this to "zope.Public" and
> try
> it again.
>
> Regards,
> Hermann
>
> --
> x1 at aon.at
> GPG key ID: 299893C7 (on keyservers)
> FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20070704/c4843e59/attachment.htm


More information about the Zope3-users mailing list