george hu wrote:
> Now I have no problem of setting up the configure.zcml, my new problem 
> is to wiring template and form together, I think I may write something 
> in the .pt file:
> 
> <span tal:repalce="structure AForm">AForm</span>

You need something like <span tal:replace="structure request.form()"/>

> 
> and place something in the __call__ method of form controller. When I do 
> it in pure formish way, I use:
> 
> ...
> form=formish.Form(schema)
> return {'AForm':form()}
> 
> the __call__ of the controller is also expected to return a dictionary, 
> but what am I supposed to put into it?  I tried return 
> {'AForm':Additem(self.context,self.request)} but it doesn't work.


The contract for what the __call__ may return a webob Response object or a 
dictionary.  This is the same contract as required of "views with renderers". 
See 
http://docs.repoze.org/bfg/1.1/narr/views.html#writing-views-which-use-a-renderer

> 
> 
> On Tue, Oct 27, 2009 at 12:44 PM, Chris McDonough <chr...@plope.com 
> <mailto:chr...@plope.com>> wrote:
> 
>     Something like this might work:
> 
>     <route name="add" path="/add"/>
> 
>     <formish:form
>       name=""
>       route_name="add"
>       controller=".forms.AddItem"/>
> 
>     george hu wrote:
> 
>         I'm trying to use the repoze.bfg.formish by checking out the
>         code from svn. I have configured the configure.zcml successfully
>         and using formish:form directive in the file. According to the
>         document, the formish:form is kind of mirror of view directive,
>         now I could not figure out how to map a url to the formish:form,
>         because the "view" attribute in the route directive can only be
>         referred to  "a function that will be used as a view callable
>         when this route matched", that is a function in "views.py". Is
>         there any way to do this? Can I write something like this:
> 
>         <route
>          path = "add"
>          view = "AddItem"
>         ....
>          >
> 
>         and the AddItem is in the formish:form
> 
>         <formish:form
>          for=".models.Item"
>          name="AddItem"
>          controller=".forms.AddItem"
>         ...
>          >
> 
> 
>         
> ------------------------------------------------------------------------
> 
>         _______________________________________________
>         Repoze-dev mailing list
>         Repoze-dev@lists.repoze.org <mailto:Repoze-dev@lists.repoze.org>
>         http://lists.repoze.org/listinfo/repoze-dev
> 
> 
> 

_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to