Задать вопрос

Тел: +7 965 3737 888

473

Просмотров

3

Ответов

Remember path decorator

<p>Decorator that stores the request.path URL in a session variable to be used later, e.g. in a "Continue Shopping" link on a cart page.  Wrap and view that you want to be able to link back to easily.  When those views are called, it updates the session with the current request.path value.  This can be pulled back out of the session whenever you need to provide a link back from whence the user came.</p>

Вопрос полезен? Да0/Нет0
file_3050.py(897.0б)
None

Ответы (3):

Ответrobhudson:13.12.2009
Ответ полезен? Да0/Нет0

@carljm: Someone did bring the multiple tabs problem to my attention, and it's a good caveat to put on this.

Ответcarljm:10.12.2009
Ответ полезен? Да0/Нет0

I wrote something almost identical to this for one of my projects, but backed it out after only a week or so in use. It tends to really wreak havoc with any kind of multiple-tabs workflow someone might be using on your site. Embrace statelessness :-)

Ответburiy:09.12.2009
Ответ полезен? Да0/Нет0

why it needs to be a decorator?

why not simple:

def shopping_view(request):
    remember_session(request)