From: Clint Ecker Date: Thu, 31 Jul 2008 23:13:28 +0000 (+0000) Subject: * Removing a print statement and fixing a small bug if you haven't set any site codes yet X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=0612bbff1eaeff67189a42d3df118b703a0ce4be;p=django-google-tools.git * Removing a print statement and fixing a small bug if you haven't set any site codes yet --- diff --git a/templatetags/analytics.py b/templatetags/analytics.py index 458d401..a1b29af 100644 --- a/templatetags/analytics.py +++ b/templatetags/analytics.py @@ -16,7 +16,6 @@ def do_get_analytics(parser, token): code = None if not code: - print "No code, grabbing from sites" current_site = Site.objects.get_current() else: if not (code[0] == code[-1] and code[0] in ('"', "'")): @@ -33,9 +32,10 @@ class AnalyticsNode(template.Node): def render(self, context): content = '' if self.site: - try: - code = self.site.analytics_set.all()[0].analytics_code - except AttributeError: + code_set = self.site.analytics_set.all() + if code_set: + code = code_set[0].analytics_code + else: return '' elif self.code: code = self.code