diff --git a/requirements.txt b/requirements.txt index b084c8e..54866de 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ django +coverage django-coverage \ No newline at end of file diff --git a/runtests.py b/runtests.py index e89dbc6..e433e9c 100644 --- a/runtests.py +++ b/runtests.py @@ -12,6 +12,16 @@ def main(): ) settings.PAGINATION__ITEMS_PER_PAGE = 5 settings.DOCUMENTATION_BASE_URL = '' + settings.DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'scielo_extensions.db', # Or path to database file if using sqlite3. + 'USER': '', # Not used with sqlite3. + 'PASSWORD': '', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '', # Set to empty string for default. Not used with sqlite3. + } + } call_command('test_coverage', 'scielo_extensions') diff --git a/scielo_extensions/templatetags/scielo_common.py b/scielo_extensions/templatetags/scielo_common.py index 0dd7dda..f7ecbe1 100755 --- a/scielo_extensions/templatetags/scielo_common.py +++ b/scielo_extensions/templatetags/scielo_common.py @@ -23,8 +23,8 @@ def inner(parser, token): inner.__doc__ = inner.__doc__ return inner -def full_path(context, **params): - +def full_path(context, page_param_name='page', **params): + url_path = '' url_get = context['request'].GET.copy() @@ -32,10 +32,13 @@ def full_path(context, **params): url_path = context['request'].META['PATH_INFO'] for key, value in params.items(): + if key == 'page' and page_param_name and page_param_name.lower() != 'page': + key = page_param_name.lower() url_get[key] = value if len(url_get): - url_path += "?%s" % "&".join(("%s=%s" % (key, value) for key, value in url_get.items() if value)) + url_path += '&' if '?' in url_get else '?' + url_path += "%s" % "&".join(("%s=%s" % (key, value) for key, value in url_get.items() if value)) return url_path.encode('utf8') @@ -50,17 +53,17 @@ def render(self, context): letters = self.letters.resolve(context) selected = self.selected.resolve(context) - html_snippet = '''