From: Stephen Finucane Date: Mon, 21 Mar 2016 17:45:17 +0000 (+0000) Subject: Remove 'requestcontext' X-Git-Tag: v2.0.0-rc1~393 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a49bfaadcda6eb8a97150365c136f434fe2da234;p=thirdparty%2Fpatchwork.git Remove 'requestcontext' This is no longer needed. Signed-off-by: Stephen Finucane Tested-by: Andy Doan --- diff --git a/patchwork/requestcontext.py b/patchwork/requestcontext.py deleted file mode 100644 index 54307dba..00000000 --- a/patchwork/requestcontext.py +++ /dev/null @@ -1,91 +0,0 @@ -# Patchwork - automated patch tracking system -# Copyright (C) 2008 Jeremy Kerr -# -# This file is part of the Patchwork package. -# -# Patchwork is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Patchwork is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Patchwork; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import - -from django.conf import settings -from django.template import RequestContext - -from patchwork.filters import Filters -from patchwork.models import Bundle, Project - - -def bundle(request): - user = request.user - if not user.is_authenticated(): - return {} - return {'bundles': Bundle.objects.filter(owner=user)} - - -class PatchworkRequestContext(RequestContext): - - def __init__(self, request, project=None, - dict=None, processors=None, - list_view=None, list_view_params={}): - self._project = project - self.filters = Filters(request) - if processors is None: - processors = [] - processors.append(bundle) - super(PatchworkRequestContext, self).__init__( - request, dict, processors) - - self.update({ - 'filters': self.filters, - 'messages': [], - }) - if list_view: - params = self.filters.params() - for param in ['order', 'page']: - data = {} - if request.method == 'GET': - data = request.GET - elif request.method == 'POST': - data = request.POST - - value = data.get(param, None) - if value: - params.append((param, value)) - self.update({ - 'list_view': { - 'view': list_view, - 'view_params': list_view_params, - 'params': params - }}) - - self.projects = Project.objects.all() - - self.update({ - 'project': self.project, - 'settings': settings, - 'other_projects': len(self.projects) > 1 - }) - - def _set_project(self, project): - self._project = project - self.filters.set_project(project) - self.update({'project': self._project}) - - def _get_project(self): - return self._project - - project = property(_get_project, _set_project) - - def add_message(self, message): - self['messages'].append(message)