Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove spaceless tag

Roland Geidera6b0d6b412e7
diff --git a/wger/core/templates/template.html b/wger/core/templates/template.html
index 4423d2fc4..ca86e881c 100644
--- a/wger/core/templates/template.html
+++ b/wger/core/templates/template.html
@@ -21,7 +21,6 @@
{% clear_breadcrumbs %}
{% endblock %}
<html lang="{{language.short_name}}">
-{% spaceless_config %}
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8">
@@ -215,5 +214,4 @@
<script src="{% static 'yarn/shariff/dist/shariff.min.js' %}"></script>
</body>
-{% endspaceless_config %}
</html>
diff --git a/wger/core/templates/template_features.html b/wger/core/templates/template_features.html
index 98b7e0e9a..ba5b0d8af 100644
--- a/wger/core/templates/template_features.html
+++ b/wger/core/templates/template_features.html
@@ -19,7 +19,6 @@
{% load i18n static compress wger_extras %}
<html lang="{{language.short_name}}">
-{% spaceless_config %}
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8">
@@ -129,5 +128,4 @@
<script src="{% static 'yarn/shariff/dist/shariff.min.js' %}"></script>
</body>
-{% endspaceless_config %}
</html>
diff --git a/wger/core/templatetags/wger_extras.py b/wger/core/templatetags/wger_extras.py
index ab23889fe..f6b215095 100644
--- a/wger/core/templatetags/wger_extras.py
+++ b/wger/core/templatetags/wger_extras.py
@@ -247,26 +247,3 @@ def format_username(user):
return user.email
else:
return user.username
-
-
-class SpacelessNode(template.base.Node):
-
- def __init__(self, nodelist):
- self.nodelist = nodelist
-
- def render(self, context):
- if settings.WGER_SETTINGS['REMOVE_WHITESPACE']:
- return strip_spaces_between_tags(self.nodelist.render(context).strip())
- else:
- return self.nodelist.render(context)
-
-
-def spaceless_config(parser, token):
- """
- This is django's spaceless tag, copied here to use our configurable
- SpacelessNode
- """
- nodelist = parser.parse(('endspaceless_config', ))
- parser.delete_first_token()
- return SpacelessNode(nodelist)
diff --git a/wger/core/tests/test_registration.py b/wger/core/tests/test_registration.py
index a8cbe9612..0d89a8043 100644
--- a/wger/core/tests/test_registration.py
+++ b/wger/core/tests/test_registration.py
@@ -43,7 +43,6 @@ class RegistrationTestCase(WgerTestCase):
with self.settings(
WGER_SETTINGS={
'USE_RECAPTCHA': True,
- 'REMOVE_WHITESPACE': False,
'ALLOW_REGISTRATION': True,
'ALLOW_GUEST_USERS': True,
'TWITTER': False,
@@ -55,7 +54,6 @@ class RegistrationTestCase(WgerTestCase):
with self.settings(
WGER_SETTINGS={
'USE_RECAPTCHA': False,
- 'REMOVE_WHITESPACE': False,
'ALLOW_REGISTRATION': True,
'ALLOW_GUEST_USERS': True,
'TWITTER': False,
@@ -116,7 +114,6 @@ class RegistrationTestCase(WgerTestCase):
with self.settings(
WGER_SETTINGS={
'USE_RECAPTCHA': False,
- 'REMOVE_WHITESPACE': False,
'ALLOW_GUEST_USERS': True,
'ALLOW_REGISTRATION': False,
}
diff --git a/wger/core/tests/test_spaceless.py b/wger/core/tests/test_spaceless.py
deleted file mode 100644
index 2a99d7c2e..000000000
--- a/wger/core/tests/test_spaceless.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# This file is part of wger Workout Manager.
-#
-# wger Workout Manager is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# wger Workout Manager 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 Affero General Public License
-
-# Standard Library
-import logging
-
-# Django
-from django.template import (
- Context,
- Template,
-)
-
-# wger
-from wger.core.tests.base_testcase import WgerTestCase
-
-
-logger = logging.getLogger(__name__)
-
-
-class SpacelessTestCase(WgerTestCase):
- """
- Tests the custom spaceless template tag
- """
-
- def test_spaceless(self):
- """
- Tests the custom spaceless template tag
- """
- t = Template(
- '{% load wger_extras %}'
- '{% spaceless_config %}<p>A text</p> <p>more</p>{% endspaceless_config %}'
- )
- context = Context()
-
- with self.settings(WGER_SETTINGS={'REMOVE_WHITESPACE': True}):
- self.assertEqual(t.render(context), '<p>A text</p><p>more</p>')
-
- with self.settings(WGER_SETTINGS={'REMOVE_WHITESPACE': False}):
- self.assertEqual(t.render(context), '<p>A text</p> <p>more</p>')
diff --git a/wger/core/tests/test_temporary_users.py b/wger/core/tests/test_temporary_users.py
index 0d32170dd..7b68bee7b 100644
--- a/wger/core/tests/test_temporary_users.py
+++ b/wger/core/tests/test_temporary_users.py
@@ -61,7 +61,6 @@ class DemoUserTestCase(WgerTestCase):
with self.settings(
WGER_SETTINGS={
'USE_RECAPTCHA': True,
- 'REMOVE_WHITESPACE': False,
'ALLOW_REGISTRATION': True,
'ALLOW_GUEST_USERS': False,
'TWITTER': False,
diff --git a/wger/settings_global.py b/wger/settings_global.py
index f566d7fff..ae56e77ca 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -425,7 +425,6 @@ USER_AGENTS_CACHE = 'default'
#
WGER_SETTINGS = {
'USE_RECAPTCHA': False,
- 'REMOVE_WHITESPACE': False,
'ALLOW_REGISTRATION': True,
'ALLOW_GUEST_USERS': True,
'ALLOW_UPLOAD_VIDEOS': False,