FW: Re : Re : [Zope3-Users] formlib problem

Pete Taylor baldtrol at gmail.com
Wed Apr 19 10:27:11 EDT 2006


Stéphane,

i'm working on what sounds to be a pretty much identical issue
currently... i'm attempting to use formlib and jsonserver.  i've been
throwing around a number of possible solutions, but none that i'm
comfortable with so far.  i agree, i don't know how to access my
form.Form class programmatically, but i don't want to sacrifice all
the utility provided me by formlib (errors, checking of invariants,
etc, etc).  i've considered having my exposed json-rpc methods pull in
the params explicitly, and then wrap them back up into formlib-style
data (if it's possible, i haven't had a chance to try yet), and then
use the handleSubmit and applyChanges logic out of formlib directly.

but i'm not happy with that solution.

i would like to find a way to build my forms agnostic of how they're
to be used, and associate jsonrpc:view's to a particular content area
that can access the forms i've displayed.  i've been really happy with
the ability to build formlib forms into viewlets, and use them
where/how i want...  but if that keeps them from being ajax-y
accessible, it will present a significant hurdle :\

if anyone has any suggestions, or has solved this kind of problem
before, i'd really appreciate pointers.  if i stumble across anything
that seems useful, i'll post it back out.

Pete

> -----Original Message-----
> From: zope3-users-bounces at zope.org [mailto:zope3-users-bounces at zope.org] On
> Behalf Of Stéphane Brault
> Sent: Wednesday, April 19, 2006 10:05 AM
> To: user-list zope
> Subject: Re : Re : [Zope3-Users] formlib problem
>
> Hi,
>   when I use formlib the traditional way (registering the page via ZCML,
> going to it via the ZMI),
>   everything works fine. The problem is I can't access it programatically.
> The thing I try to do
>   is :
>   - call a method via JSON RPC (by the way jsonserver is great ;-))
>   - in this method I get my object (through sqlos, which is nice too ;-))
> and then call the formlib class to render my page in html
>   - send back the html which is used to update  my page.
>   Has anyone tried to use formlib this way, I really need to use AJAX and it
> seems that I can't have both working together,
>   I must be missing something.
>
>   Thanks,
>
>   Stéphane
>
> ----- Message d'origine ----
> De : Stéphane Brault <stephane_brault at yahoo.fr> À : zope3-users at zope.org
> Envoyé le : Mardi, 18 Avril 2006, 4h16mn 55s Objet : Re : [Zope3-Users]
> formlib problem
>
> Thanks Michael,
>  There is indeed something missing :
>  ComponentLookupError: ((
>   zope.schema._bootstrapfields.Int object at 0x01A83610 ,
>   zope.publisher.browser.TestRequest instance URL=http://127.0.0.1 ),
>   InterfaceClass zope.app.form.interfaces.IDisplayWidget , u'')  My problem
> has nothing to do with containers, since my interface is  not a container.
> It seems that zope can't find the adapters for the shema fields, even when
> I register them by code. I really don't know what to do from now.
>  The fact is I use AJAX, so I don't need to register my views, I just  call
> them from code to use the generated html as a response to a  javascript call
> that then update my page.
>
>  Thanks,
>
>  Stéphane
>
>
>
> ----- Message d'origine ----
> De : Michael Howitz <mh at gocept.com>
> À : Stéphane Brault <stephane_brault at yahoo.fr> Cc : user-list zope
> <zope3-users at zope.org> EnvoyÃ(c) le : Mardi, 18 Avril 2006, 3h40mn 16s ObjetÂ
> : Re: [Zope3-Users] formlib problem
>
> Stéphane Brault wrote:
> > Hi,
> >  I can't use formlib, when I run the example in the form.txt I get this
> error:
> >  Traceback (most recent call last):
> >    File "<pyshell#29>", line 1, in -toplevel-
> >      print MyForm(None, request)()
> >    File "<pyshell#26>", line 6, in __call__
> >      widgets = form.setUpWidgets(self.form_fields, 'form', self.context,
> self.request, ignore_request= ignore_request)
> >    File "C:\Python24\Lib\site-packages\zope\formlib\form.py", line 255, in
> setUpWidgets
> >      IInputWidget)
> >    File "C:\Python24\Lib\site-packages\zope\component\__init__.py", line
> 154, in getMultiAdapter
> >      raise ComponentLookupError(objects, interface, name)
> >  ComponentLookupError: ((, http://127.0.0.1>), , u'')
>
> There seems to be something missing before ", http..." ... did you copy it
> form the browser output?
>
> >
> >  It happens when setUpWidgets is called in the first example, do I need to
> import something or to configure a component for formlib to work ?
> >  Any hint ?
>
> Guess out of the dust: does the interface of the object you want to display
> have a zope.app.container.constraints.containers directive?
>
> This thread seems similar to your problem.
> http://mail.zope.org/pipermail/zope3-users/2006-March/002802.html
>
> HTH,
>   mac
>
>
>
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
>
>
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users


--
"All guilt is relative, loyalty counts, and never let your conscience
be your guide."
  - Lucas Buck, American Gothic


More information about the Zope3-users mailing list