Ejemplo n.º 1
0
def get_filestore(context, request, form_id):
    session = get_session(context, request)
    mapping = session.get(form_id)
    if mapping is None:
        session[form_id] = PersistentMapping()
        mapping = session[form_id]
    filestore = ZODBFileStore(mapping)
    return filestore
Ejemplo n.º 2
0
def _calendar_filter(context, request):
    session = get_session(context, request)

    filt = request.params.get('filter', None)
    if filt is None:
        filt = session.get('calendar_filter', None)
    session['calendar_filter'] = filt
    return filt
Ejemplo n.º 3
0
 def test_get_session(self):
     from karl.utils import get_session
     context = testing.DummyModel()
     session = testing.DummyModel()
     sessions = testing.DummyModel()
     sessions['abc'] = session
     context.sessions = sessions
     request = testing.DummyRequest()
     request.environ['repoze.browserid'] = 'abc'
     result = get_session(context, request)
     self.assertEqual(result, session)
Ejemplo n.º 4
0
 def test_get_session(self):
     from karl.utils import get_session
     context = testing.DummyModel()
     session = testing.DummyModel()
     sessions = testing.DummyModel()
     sessions['abc'] = session
     context.sessions = sessions
     request = testing.DummyRequest()
     request.environ['repoze.browserid'] = 'abc'
     result = get_session(context, request)
     self.assertEqual(result, session)
Ejemplo n.º 5
0
def _date_requested(context, request):
    now = _now()
    session = get_session(context, request)
    if 'year' in request.GET:
        year  = int(request.GET.get('year', now.year))
        month = int(request.GET.get('month', now.month))
        day   = int(request.GET.get('day', now.day))
        value = (year, month, day)
        session['calendar_date_requested'] = value
    elif 'calendar_date_requested' in session:
        value = session['calendar_date_requested']
    else:
        value = (now.year, now.month, now.day)
    return value
Ejemplo n.º 6
0
 def _callFUT(self, context, request):
     from karl.utils import get_session
     return get_session(context, request)
Ejemplo n.º 7
0
 def _callFUT(self, context, request):
     from karl.utils import get_session
     return get_session(context, request)