On Fri, 2011-08-05 at 16:59 +0200, Keesjan van Bunningen wrote:
> I already spotted that one, Chris.
> 
> Problem is I don't have access to the current request within the context of 
> a widget template ?!
> 
> The only entities I have access to are 'field' and 'cstruct'.

Something like this (untested, sorry):

Set a deferred as an argument to the schema node you're trying to mess
with:

   @colander.deferred
   def deferred_request(node, kw):
       return kw['pyramid_request']

   class MySchema(colander.Schema):
       mynode = colander.SchemaNode(.., request=deferred_request)

Bind your schema in view code so that it can resolve the deferred:

   schema = MySchema().bind(pyramid_request=request)

Then in the template for the mynode's type, do:

   field.schema.request

- C


-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to