[Zope3-Users] Re: Sending data to widgets
Frank Burkhardt
fbo2 at gmx.net
Tue Apr 18 12:55:48 EDT 2006
On Tue, Apr 18, 2006 at 10:28:38AM -0400, Gary Poster wrote:
[snip]
> >Perhaps it's overkill to write adapter for all my content objects. I think
> >I found a solution. The Request object might be RO but I can smuggle an object
> >reference inside the reponse headers and removed it after all the widgets are
> >processed.
>
> augh! :-)
>
> Philipp is leading you correctly. I might even be tempted to write a
> custom form that directly set the data for the widgets myself; maybe that
> would be a quicker and easier approach to the same road.
That's what I did. I used formlib to create widgets, added an attribute
containing the information I needed to send from the view to the widgets.
It worked like a charm - until I used some more complex data structures
(Lists, Dicts). I don't know a way of adding attributes to the subwidgets
of e.g. ListWidgets because those subwidgets are created on the fly during
the ListWidgets' rendering/query-parsing process.
Works:
IMyObject
+-i18ntext
Doesn't work:
IMyNewObject
+-List of...
| +-i18ntext
+-Dict of...
+-(BytesLine,i18ntext)
> If you still don't want to listen to him, please don't do the response
> hack you are talking about. the request has an `annotations` attribute
> which experts can use to stash things away. Beware: this is a road that
> has bitten many in Zope 2, and is easily abused.
I would really like always to use the Zope(tm) way. I'll try the annotations
attribute (although I'm not really an expert :-) ).
Thank you,
Frank
More information about the Zope3-users
mailing list