On Tue, Apr 18, 2006 at 03:20:49PM +0200, Philipp von Weitershausen wrote:


> Right. Requests are read-only to the application.
> > It there a chance to transport data throught the request object
> > without modifying the depth of the zope core?
> > 
> > Maybe there's a way for widgets to access the view class directly?
> A typical solution is to push data to the widgets. IWidget (from
> zope.app.form.interfaces) defines a 'setRenderedValue' method for
> widgets that can be used to do that.
> If you are using zope.formlib, you can also implement a custom
> setUpWidgets method (documented in IFormBaseCustomization from
> zope.formlib.interfaces). The default one for edit forms looks like this:
>     def setUpWidgets(self, ignore_request=False):
>         self.adapters = {}
>         self.widgets = setUpEditWidgets(
>             self.form_fields, self.prefix, self.context, self.request,
>             adapters=self.adapters, ignore_request=ignore_request
>             )
> setUpEditWidgets (defined in zope.formlib.form) will take the widget's
> default values from self.context. For example, you could pass in
> something other than that (perhaps an object holding the data you want
> the widgets to present). You just have to make sure that it also
> provides the interface that you're generating the form from.

My problem is not about data the widget should display but about data
that controls the widget's behaviour.

In this case my form consists of some widgets representing a schema interface
plus a special "I18NController" widget which is e.g. used to define, in which
order different language versions of the form's fields should be displayed.
(->This is about I18Nd content, stored in dictionary-fields)

Problem is: Some of the Widgets that should receive data from the 
are not known to the formlib because they are multiadapter-queried inside e.g.
a ListInputWidget. The request + the context seem to be the only objects 
to all the widgets - but I don't want to store language order information in 
zodb which
leaves the request object only.

Is there really no chance to store information as attributes of the request?


Zope3-users mailing list

Reply via email to