From 6c0dc29f5c2523ea0711b04e31a6791ce57a3d28 Mon Sep 17 00:00:00 2001 From: nhuzaa Date: Sun, 29 Oct 2017 15:12:51 +0545 Subject: [PATCH] Removed Whitespaces --- google_analytics/models.py | 2 +- .../analytics_async_template.html | 12 +++++------ .../google_analytics/analytics_template.html | 14 ++++++------- google_analytics/templatetags/analytics.py | 10 +++++----- google_analytics/tests/test_templatetags.py | 20 +++++++++---------- 5 files changed, 28 insertions(+), 30 deletions(-) diff --git a/google_analytics/models.py b/google_analytics/models.py index 58e0eed..e159f60 100644 --- a/google_analytics/models.py +++ b/google_analytics/models.py @@ -8,6 +8,6 @@ class Analytics(models.Model): def __unicode__(self): return u"%s" % (self.analytics_code) - + class Meta: verbose_name_plural = "Analytics" diff --git a/google_analytics/templates/google_analytics/analytics_async_template.html b/google_analytics/templates/google_analytics/analytics_async_template.html index e706e5b..fccd3b0 100644 --- a/google_analytics/templates/google_analytics/analytics_async_template.html +++ b/google_analytics/templates/google_analytics/analytics_async_template.html @@ -1,15 +1,15 @@ diff --git a/google_analytics/templates/google_analytics/analytics_template.html b/google_analytics/templates/google_analytics/analytics_template.html index 2529f4e..54ecd08 100644 --- a/google_analytics/templates/google_analytics/analytics_template.html +++ b/google_analytics/templates/google_analytics/analytics_template.html @@ -1,12 +1,12 @@ diff --git a/google_analytics/templatetags/analytics.py b/google_analytics/templatetags/analytics.py index 1e34196..432cb34 100644 --- a/google_analytics/templatetags/analytics.py +++ b/google_analytics/templatetags/analytics.py @@ -20,7 +20,7 @@ def do_get_analytics(parser, token): code = None else: raise template.TemplateSyntaxError, "%r cannot take more than one argument" % tag_name - + if not code: current_site = Site.objects.get_current() else: @@ -30,13 +30,13 @@ def do_get_analytics(parser, token): current_site = None return AnalyticsNode(current_site, code, template_name) - + class AnalyticsNode(template.Node): def __init__(self, site=None, code=None, template_name='google_analytics/analytics_template.html'): self.site = site self.code = code self.template_name = template_name - + def render(self, context): content = '' if self.site: @@ -49,7 +49,7 @@ def render(self, context): code = self.code else: return '' - + if code.strip() != '': t = loader.get_template(self.template_name) c = Context({ @@ -61,6 +61,6 @@ def render(self, context): return t.render(c) else: return '' - + register.tag('analytics', do_get_analytics) register.tag('analytics_async', do_get_analytics) diff --git a/google_analytics/tests/test_templatetags.py b/google_analytics/tests/test_templatetags.py index d440abc..d1f8a38 100644 --- a/google_analytics/tests/test_templatetags.py +++ b/google_analytics/tests/test_templatetags.py @@ -3,7 +3,7 @@ from django import template from django.contrib.sites.models import Site from google_analytics.models import Analytics -from google_analytics.templatetags import analytics +from google_analytics.templatetags import analytic code7 = 'UA-777777-3' # for fixture-based codes code9 = 'UA-999999-1' # for explicit codes @@ -36,11 +36,11 @@ def _test_null_node_template(self): def test_noarg_node_template(self): node = analytics.do_get_analytics(self.parser, self.token_noarg) self.assertEqual(node.template_name, 'google_analytics/test_template.html') - + def test_onearg_node_template(self): node = analytics.do_get_analytics(self.parser, self.token_onearg) self.assertEqual(node.template_name, 'google_analytics/test_template.html') - + def test_twoarg_node_exception(self): self.assertRaises(template.TemplateSyntaxError, analytics.do_get_analytics, self.parser, self.token_twoarg) @@ -59,7 +59,7 @@ class NodeTest(TestCase): """Test set-up and rendering of AnalyticsNodes""" fixtures = ['analytics_test'] - + def setUp(self): self.site = Site.objects.get_current() self.node_noarg = analytics.AnalyticsNode() @@ -74,7 +74,7 @@ def test_fixture(self): def test_default_template_name(self): self.assertEqual( - self.node_code.template_name, + self.node_code.template_name, 'google_analytics/analytics_template.html' ) @@ -90,12 +90,12 @@ def test_noarg_code_name(self): def test_explicit_template_name(self): self.assertEqual( - self.node_explicit_template.template_name, + self.node_explicit_template.template_name, 'google_analytics/test_template.html' ) self.assertEqual( self.node_explicit_template.render(template.Context()).strip(), - 'Tracking code: %s' % code9 + 'Tracking code: %s' % code9 ) def test_defined_site(self): @@ -107,7 +107,7 @@ def test_defined_site(self): ) def test_site_overrides_explicit_code(self): - """If both code and site are set, the site code will override the + """If both code and site are set, the site code will override the explicitly set code. This is contrary to how the tag works, but the parser never passes this combination of arguments.""" @@ -115,7 +115,5 @@ def test_site_overrides_explicit_code(self): self.assertEqual(self.node_code_and_site.site, self.site) self.assertEqual( self.node_code_and_site.render(template.Context()).strip(), - 'Tracking code: %s' % code7 + 'Tracking code: %s' % code7 ) - -