Change session progress API.
Breaks compatibility, but worth it I think..
This commit is contained in:
parent
4909188ee3
commit
5b173dd9bc
4 changed files with 16 additions and 14 deletions
|
@ -1,9 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2012 Lance Edgar
|
||||
# Copyright © 2010-2014 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -26,14 +25,17 @@
|
|||
Progress Indicator
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from beaker.session import Session
|
||||
|
||||
|
||||
def get_progress_session(session, key):
|
||||
request = session.request
|
||||
id = '%s.progress.%s' % (session.id, key)
|
||||
session = Session(request, id)
|
||||
return session
|
||||
def get_progress_session(request, key):
|
||||
"""
|
||||
Create/get a Beaker session object, to be used for progress.
|
||||
"""
|
||||
id = '{0}.progress.{1}'.format(request.session.id, key)
|
||||
return Session(request, id, use_cookies=False)
|
||||
|
||||
|
||||
class SessionProgress(object):
|
||||
|
@ -45,8 +47,8 @@ class SessionProgress(object):
|
|||
for display to the user.
|
||||
"""
|
||||
|
||||
def __init__(self, session, key):
|
||||
self.session = get_progress_session(session, key)
|
||||
def __init__(self, request, key):
|
||||
self.session = get_progress_session(request, key)
|
||||
self.canceled = False
|
||||
self.clear()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue