I changed the definition of the inclusion tag to accept a second
parameter in the form of:

def my_function(context, myparam):
    ...

but I didn't get access to the variables  in the context, I had to:

return {
    'myparam': myparam,
    'acontextvar': context['acontextvar']
}

Is this normal, or am I supposed to get access to all of them once I
include context as my first param?


On Apr 1, 3:26 pm, Panos Laganakos <[EMAIL PROTECTED]> wrote:
> OK, I (think!) understand that.
>
> But what if the inclusion tag requires an argument, that's not always
> in the same context?
>
> On Apr 1, 3:12 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > On Tue, 2008-04-01 at 04:58 -0700, Panos Laganakos wrote:
> > > Is there some way to have inclusion tags pick up on the variables
> > > available from REQUEST_CONTEXT_PROCESSORS?
>
> > > I've read about `takes_context` option, but I couldn't figure out if I
> > > could use it to get access to the above.
>
> > The context processors run before the template rendering starts and they
> > modify the context that is passed into the template. So if your tag
> > accepts the context, it will have access to all the variables in the
> > context, which includes those added by the context processors.
>
> > Regards,
> > Malcolm
>
> > --
> > Why be difficult when, with a little bit of effort, you could be
> > impossible.http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to