Hi all,
Is there any way of getting the request.path value without having the
request object that Django pass's around. Is there something similar
to os.environ for the web request where I can get the path?
I'm developing an app that needs to cache data on a page basis but the
data may come from
I've looked at http://www.djangobook.com/en/beta/chapter12/ and the
section on Using sessions outside of views which shows:
>>> from django.contrib.sessions.models import Session
>>> s =
Session.objects.get_object(pk='2b1189a188b44ad18c35e113ac6ceead')
But where does that pk come from?
I'm down
I think perhaps I'll also put this problem another way. I need to
cache data against the current web request without having the Django
built request object.
On Jul 31, 4:56 pm, cootetom wrote:
> Hi all,
>
> Is there any way of getting the request.path value without having the
> request object t
Just add django.core.context_processors.request to your
TEMPLATE_CONTEXT_PROCESSORS, this way you can access the current
request object in your template, you will have to use however
RequestContext class with render_to_response,
>From docs:
django.core.context_processors.request
If TEMPLATE_CONT
Thanks Carlos but I'm trying to achieve getting the path without
having to pass the request object.
On Jul 31, 7:11 pm, Carlos Daniel Ruvalcaba Valenzuela
wrote:
> Just add django.core.context_processors.request to your
> TEMPLATE_CONTEXT_PROCESSORS, this way you can access the current
> request
On Sat, Jul 31, 2010 at 12:37 PM, cootetom wrote:
> Thanks Carlos but I'm trying to achieve getting the path without
> having to pass the request object.
In a word: don't.
Instead, design your system to pass the information you need where and
when you need it. This doesn't mean everything always
I have found some code that can get the request object.
f = sys._getframe()
while f:
request = f.f_locals.get('request')
if isinstance(request, HttpRequest):
path = request.path
break
f = f.f_back
James: I understand completely what you are saying and have thought
lon
I have finished and made this app available via it's own web site.
Take a look http://poedit.tomcoote.co.uk/
On Aug 1, 1:18 pm, cootetom wrote:
> I have found some code that can get the request object.
>
> f = sys._getframe()
> while f:
> request = f.f_locals.get('request')
> if isinst
On 27/08/10 14:22, Sells, Fred wrote:
> I'm not sure of the thread safety of Django and wonder if I could store
> this object as a local variable of some module like
No, that is not likely to work except in a single-threaded* context, and
even then it's a bit fraught (just being single-threaded s
9 matches
Mail list logo