[PATCH] views: Avoid mutable default arguments

Stephen Finucane stephenfinucane at hotmail.com
Sun Sep 4 10:29:50 AEST 2016


Signed-off-by: Stephen Finucane <stephenfinucane at hotmail.com>
---
 patchwork/views/__init__.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/patchwork/views/__init__.py b/patchwork/views/__init__.py
index ddddf63..15695d6 100644
--- a/patchwork/views/__init__.py
+++ b/patchwork/views/__init__.py
@@ -185,9 +185,12 @@ def set_bundle(request, project, action, data, patches, context):
     return []
 
 
-def generic_list(request, project, view,
-                 view_args={}, filter_settings=[], patches=None,
-                 editable_order=False):
+def generic_list(request, project, view, view_args=None, filter_settings=None,
+                 patches=None, editable_order=False):
+
+    if not filter_settings:
+        filter_settings = []
+
     filters = Filters(request)
     context = {
         'project': project,
@@ -220,7 +223,7 @@ def generic_list(request, project, view,
         'order': order,
         'list_view': {
             'view': view,
-            'view_params': view_args,
+            'view_params': view_args or {},
             'params': params
         }})
 
-- 
2.7.4



More information about the Patchwork mailing list