def pastebin_manage_view(context, request): params = request.params message = params.get('message', u'') if params.has_key('form.submitted'): form = marshal(request.environ, request.body_file) checkboxes = form.get('delete', []) for checkbox in checkboxes: del context[checkbox] message = '%s pastes deleted' % len(checkboxes) url = resource_url(context, request, 'manage', query={'message':message}) response = HTTPFound(location=url) response.headers['Location'] = url return response pastebin_url = resource_url(context, request) pastes = utils.get_pastes(context, request, sys.maxint) return dict( api = utils.API(context, request), pastes = pastes, message = message, pastebin_url = pastebin_url, )
def manage_view(context, request): params = request.params app_url = request.application_url if params.has_key('form.submitted'): form = marshal(request.environ, request.body_file) checkboxes = form.get('delete', []) for checkbox in checkboxes: del context[checkbox] return HTTPFound(location=app_url) pastes = get_pastes(context, request, sys.maxint) return dict( version = app_version, pastes = pastes, application_url = app_url, )
def manage_view(context, request): params = request.params app_url = request.application_url if params.has_key('form.submitted'): form = marshal(request.environ, request.body_file) checkboxes = form.get('delete', []) for checkbox in checkboxes: del context[checkbox] return HTTPFound(location=app_url) pastes = get_pastes(context, request, sys.maxint) return dict( version=app_version, pastes=pastes, application_url=app_url, )
def tutorialbin_manage_view(context, request): params = request.params message = params.get('message', u'') if params.has_key('form.submitted'): form = marshal(request.environ, request.body_file) checkboxes = form.get('delete', []) for checkbox in checkboxes: del context[checkbox] message = '%s tutorials deleted' % len(checkboxes) url = resource_url(context, request, 'manage', query={'message':message}) response = HTTPFound(location=url) return response tutorials = get_tutorials(context, request, sys.maxint) tutorialbin_url = resource_url(context, request) return dict( api = API(context, request), message = message, tutorials = tutorials, tutorialbin_url = tutorialbin_url, )