]> git.ozlabs.org Git - patchwork/commitdiff
trivial: Remove dead files/code
authorStephen Finucane <stephen.finucane@intel.com>
Fri, 21 Aug 2015 14:32:08 +0000 (15:32 +0100)
committerDamien Lespiau <damien.lespiau@intel.com>
Thu, 17 Sep 2015 16:40:42 +0000 (17:40 +0100)
Remove some swathes of code that are no longer used, some of which
contains issues that renders them useless.

This unused code was initially discovered by using 'coverage.py'
followed by manual inspection.

Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
patchwork/context_processors.py [deleted file]
patchwork/requestcontext.py
patchwork/templatetags/filter.py [deleted file]
patchwork/templatetags/listurl.py
patchwork/templatetags/order.py [deleted file]
patchwork/templatetags/patch.py
patchwork/templatetags/pwurl.py [deleted file]
templates/base.html

diff --git a/patchwork/context_processors.py b/patchwork/context_processors.py
deleted file mode 100644 (file)
index f4ab5a9..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-# Patchwork - automated patch tracking system
-# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
-#
-# 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 patchwork.models import Bundle
-from patchwork.utils import order_map, get_order
-
-def bundle(request):
-    user = request.user
-    if not user.is_authenticated():
-        return {}
-    return {'bundles': Bundle.objects.filter(owner = user)}
-
-
-def patchlists(request):
-
index 342d3803f0b9e6dc5750dd4d81c2523d87e93dfb..3652edc8f8c58f0dbe3dc0227fbca4e1185a02aa 100644 (file)
@@ -30,12 +30,6 @@ def bundle(request):
         return {}
     return {'bundles': Bundle.objects.filter(owner = user)}
 
-def _params_as_qs(params):
-    return '&'.join([ '%s=%s' % (escape(k), escape(v)) for k, v in params ])
-
-def _params_as_hidden_fields(params):
-    return '\n'.join([ '<input type="hidden" name="%s" value="%s"/>' % \
-                (escape(k), escape(v)) for k, v in params ])
 
 class PatchworkRequestContext(RequestContext):
     def __init__(self, request, project = None,
diff --git a/patchwork/templatetags/filter.py b/patchwork/templatetags/filter.py
deleted file mode 100644 (file)
index 7a5d9df..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# Patchwork - automated patch tracking system
-# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
-#
-# 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 django import template
-from django.utils.html import escape
-
-import re
-
-
-register = template.Library()
-
-@register.filter
-def personify(person):
-    if person.name:
-        linktext = escape(person.name)
-    else:
-        linktext = escape(person.email)
-
-    return '<a href="javascript:personpopup(\'%s\')">%s</a>' % (escape(person.email), linktext)
-
index 5fe03e469c43d1b46b3015abec468dda9e43ee8a..6dbdd745815d4df0cef82031f8fe60906097ab47 100644 (file)
@@ -78,8 +78,8 @@ class ListURLNode(template.defaulttags.URLNode):
 def listurl(parser, token):
     bits = token.contents.split(' ', 1)
     if len(bits) < 1:
-        raise TemplateSyntaxError("'%s' takes at least one argument"
-                                  " (path to a view)" % bits[0])
+        raise template.TemplateSyntaxError(
+            "'%s' takes at least one argument (path to a view)" % bits[0])
     kwargs = {}
     if len(bits) > 1:
         for arg in bits[1].split(','):
@@ -88,49 +88,6 @@ def listurl(parser, token):
                 k = k.strip()
                 kwargs[k] = parser.compile_filter(v)
             else:
-                raise TemplateSyntaxError("'%s' requires name=value params" \
-                                          % bits[0])
+                raise template.TemplateSyntaxError(
+                    "'%s' requires name=value params" % bits[0])
     return ListURLNode(kwargs)
-
-class ListFieldsNode(template.Node):
-    def __init__(self, params):
-        self.params = params
-
-    def render(self, context):
-        self.view_name = template.Variable('list_view.view').resolve(context)
-        try:
-            qs_var = template.Variable('list_view.params')
-            params = dict(qs_var.resolve(context))
-        except Exception:
-            pass
-
-        params.update(self.params)
-
-        if not params:
-            return ''
-
-        str = ''
-        for (k, v) in params.iteritems():
-            str += '<input type="hidden" name="%s" value="%s"\>' % \
-                   (k, escape(v))
-
-        return mark_safe(str)
-
-@register.tag
-def listfields(parser, token):
-    bits = token.contents.split(' ', 1)
-    if len(bits) < 1:
-        raise TemplateSyntaxError("'%s' takes at least one argument"
-                                  " (path to a view)" % bits[0])
-    params = {}
-    if len(bits) > 2:
-        for arg in bits[2].split(','):
-            if '=' in arg:
-                k, v = arg.split('=', 1)
-                k = k.strip()
-                params[k] = parser.compile_filter(v)
-            else:
-                raise TemplateSyntaxError("'%s' requires name=value params" \
-                                          % bits[0])
-    return ListFieldsNode(bits[1], params)
-
diff --git a/patchwork/templatetags/order.py b/patchwork/templatetags/order.py
deleted file mode 100644 (file)
index e392f03..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-# Patchwork - automated patch tracking system
-# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
-#
-# 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 django import template
-import re
-
-register = template.Library()
-
-@register.tag(name = 'ifpatcheditable')
-def do_patch_is_editable(parser, token):
-    try:
-        tag_name, name, cur_order = token.split_contents()
-    except ValueError:
-        raise template.TemplateSyntaxError("%r tag requires two arguments" \
-                % token.contents.split()[0])
-
-    end_tag = 'endifpatcheditable'
-    nodelist_true = parser.parse([end_tag, 'else'])
-
-    token = parser.next_token()
-    if token.contents == 'else':
-        nodelist_false = parser.parse([end_tag])
-        parser.delete_first_token()
-    else:
-        nodelist_false = template.NodeList()
-
-    return EditablePatchNode(patch_var, nodelist_true, nodelist_false)
-
-class EditablePatchNode(template.Node):
-    def __init__(self, patch_var, nodelist_true, nodelist_false):
-        self.nodelist_true = nodelist_true
-        self.nodelist_false = nodelist_false
-        self.patch_var = template.Variable(patch_var)
-        self.user_var = template.Variable('user')
-
-    def render(self, context):
-        try:
-            patch = self.patch_var.resolve(context)
-            user = self.user_var.resolve(context)
-        except template.VariableDoesNotExist:
-            return ''
-
-        if not user.is_authenticated():
-            return self.nodelist_false.render(context)
-
-        if not patch.is_editable(user):
-            return self.nodelist_false.render(context)
-
-        return self.nodelist_true.render(context)
index ea23ebd7aa7ce4bcf60e40236e58ade6a73d6f92..57f289e1179c4a5ec78b05433c66649ee7e62cfd 100644 (file)
 
 from django import template
 from django.utils.safestring import mark_safe
-import re
 
 register = template.Library()
 
-@register.tag(name = 'ifpatcheditable')
-def do_patch_is_editable(parser, token):
-    try:
-        tag_name, patch_var = token.split_contents()
-    except ValueError:
-        raise template.TemplateSyntaxError("%r tag requires one argument" \
-                % token.contents.split()[0])
-
-    end_tag = 'endifpatcheditable'
-    nodelist_true = parser.parse([end_tag, 'else'])
-
-    token = parser.next_token()
-    if token.contents == 'else':
-        nodelist_false = parser.parse([end_tag])
-        parser.delete_first_token()
-    else:
-        nodelist_false = template.NodeList()
-
-    return EditablePatchNode(patch_var, nodelist_true, nodelist_false)
-
-class EditablePatchNode(template.Node):
-    def __init__(self, patch_var, nodelist_true, nodelist_false):
-        self.nodelist_true = nodelist_true
-        self.nodelist_false = nodelist_false
-        self.patch_var = template.Variable(patch_var)
-        self.user_var = template.Variable('user')
-
-    def render(self, context):
-        try:
-            patch = self.patch_var.resolve(context)
-            user = self.user_var.resolve(context)
-        except template.VariableDoesNotExist:
-            return ''
-
-        if not user.is_authenticated():
-            return self.nodelist_false.render(context)
-
-        if not patch.is_editable(user):
-            return self.nodelist_false.render(context)
-
-        return self.nodelist_true.render(context)
 
 @register.filter(name='patch_tags')
 def patch_tags(patch):
diff --git a/patchwork/templatetags/pwurl.py b/patchwork/templatetags/pwurl.py
deleted file mode 100644 (file)
index 98bc1ca..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-# Patchwork - automated patch tracking system
-# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
-#
-# 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 django import template
-from django.utils.html import escape
-from django.utils.safestring import mark_safe
-from patchwork.filters import filterclasses
-import re
-
-register = template.Library()
-
-# params to preserve across views
-list_params = [ c.param for c in filterclasses ] + ['order', 'page']
-
-class ListURLNode(template.defaulttags.URLNode):
-    def __init__(self, *args, **kwargs):
-        super(ListURLNode, self).__init__(*args, **kwargs)
-        self.params = {}
-        for (k, v) in kwargs:
-            if k in list_params:
-                self.params[k] = v
-
-    def render(self, context):
-        self.view_name = template.Variable('list_view.view')
-        str = super(ListURLNode, self).render(context)
-        if str == '':
-            return str
-        params = []
-        try:
-            qs_var = template.Variable('list_view.params')
-            params = dict(qs_var.resolve(context))
-        except Exception:
-            pass
-
-        params.update(self.params)
-
-        if not params:
-            return str
-
-        return str + '?' + '&'.join(['%s=%s' % (k, escape(v)) \
-                        for (k, v) in params.iteritems()])
-
-@register.tag
-def listurl(parser, token):
-    bits = token.contents.split(' ', 1)
-    if len(bits) < 1:
-        raise TemplateSyntaxError("'%s' takes at least one argument"
-                                  " (path to a view)" % bits[0])
-    args = ['']
-    kwargs = {}
-    if len(bits) > 1:
-        for arg in bits[2].split(','):
-            if '=' in arg:
-                k, v = arg.split('=', 1)
-                k = k.strip()
-                kwargs[k] = parser.compile_filter(v)
-            else:
-                args.append(parser.compile_filter(arg))
-    return PatchworkURLNode(bits[1], args, kwargs)
-
index 3d289fb226b21c279523719f1ccc33d533aec1b0..c2053d467a94a53b8c65678ba1857e77d0a21337 100644 (file)
@@ -1,5 +1,4 @@
 {% load staticfiles %}
-{% load pwurl %}
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">