From bfd4db5d350e9bd3ed1f8826a4c58a6a72e900db Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sun, 10 Nov 2019 03:33:27 -0400 Subject: [PATCH] Add a query dict argument to common.http.URL Signed-off-by: Roberto Rosario --- HISTORY.rst | 1 + mayan/apps/common/http.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index d778bbcda5..9a5ce21641 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -127,6 +127,7 @@ Fix passing the dynamic Meta class to the test model. - Support for proxy model permission inheritance. Proxy models now get the permission inheritance from their base models. +- Update common.http.URL to allow passing a query dictionary. 3.2.9 (2019-11-03) ================== diff --git a/mayan/apps/common/http.py b/mayan/apps/common/http.py index ba507523d2..02c274fdc6 100644 --- a/mayan/apps/common/http.py +++ b/mayan/apps/common/http.py @@ -6,15 +6,20 @@ from django.utils.six import PY3 class URL(object): - def __init__(self, path=None, query_string=None): + def __init__(self, path=None, query_string=None, query=None): self._path = path self._query_string = query_string + self._query = query + kwargs = {'mutable': True} - if query_string: - kwargs['query_string'] = query_string.encode('utf-8') + if self._query_string: + kwargs['query_string'] = self._query_string.encode('utf-8') self._args = QueryDict(**kwargs) + if self._query: + self.args.update(self._query) + @property def args(self): return self._args