mirror of
https://github.com/jazzband/django-analytical.git
synced 2026-04-29 03:04:43 +00:00
Merge pull request #33 from craigbruce/master
Replaced simplejson with json
This commit is contained in:
commit
6763d3e06b
11 changed files with 19 additions and 22 deletions
|
|
@ -4,13 +4,13 @@ Chartbeat template tags and filters.
|
|||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.sites.models import Site
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils import simplejson
|
||||
|
||||
from analytical.utils import is_internal_ip, disable_html, get_required_setting
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ class ChartbeatBottomNode(Node):
|
|||
domain = _get_domain(context)
|
||||
if domain is not None:
|
||||
config['domain'] = domain
|
||||
html = SETUP_CODE % {'config': simplejson.dumps(config)}
|
||||
html = SETUP_CODE % {'config': json.dumps(config)}
|
||||
if is_internal_ip(context, 'CHARTBEAT'):
|
||||
html = disable_html(html, 'Chartbeat')
|
||||
return html
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ from __future__ import absolute_import
|
|||
import re
|
||||
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils import simplejson
|
||||
|
||||
from analytical.utils import get_identity, is_internal_ip, disable_html, get_required_setting
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ Clicky template tags and filters.
|
|||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils import simplejson
|
||||
|
||||
from analytical.utils import get_identity, is_internal_ip, disable_html, \
|
||||
get_required_setting
|
||||
|
|
@ -66,7 +66,7 @@ class ClickyNode(Node):
|
|||
custom.setdefault('session', {})['username'] = identity
|
||||
|
||||
html = TRACKING_CODE % {'site_id': self.site_id,
|
||||
'custom': simplejson.dumps(custom)}
|
||||
'custom': json.dumps(custom)}
|
||||
if is_internal_ip(context, 'CLICKY'):
|
||||
html = disable_html(html, 'Clicky')
|
||||
return html
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import re
|
|||
|
||||
from django.conf import settings
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils import simplejson
|
||||
|
||||
from analytical.utils import get_identity, get_user_from_context, \
|
||||
is_internal_ip, disable_html, get_required_setting
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ KISSmetrics template tags.
|
|||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils import simplejson
|
||||
|
||||
from analytical.utils import is_internal_ip, disable_html, get_identity, \
|
||||
get_required_setting
|
||||
|
|
@ -78,13 +78,13 @@ class KissMetricsNode(Node):
|
|||
try:
|
||||
name, properties = context[EVENT_CONTEXT_KEY]
|
||||
commands.append(EVENT_CODE % {'name': name,
|
||||
'properties': simplejson.dumps(properties)})
|
||||
'properties': json.dumps(properties)})
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
properties = context[PROPERTY_CONTEXT_KEY]
|
||||
commands.append(PROPERTY_CODE % {
|
||||
'properties': simplejson.dumps(properties)})
|
||||
'properties': json.dumps(properties)})
|
||||
except KeyError:
|
||||
pass
|
||||
html = TRACKING_CODE % {'api_key': self.api_key,
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ Mixpanel template tags and filters.
|
|||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils import simplejson
|
||||
|
||||
from analytical.utils import is_internal_ip, disable_html, get_identity, \
|
||||
get_required_setting
|
||||
|
|
@ -56,7 +56,7 @@ class MixpanelNode(Node):
|
|||
try:
|
||||
name, properties = context[EVENT_CONTEXT_KEY]
|
||||
commands.append(EVENT_CODE % {'name': name,
|
||||
'properties': simplejson.dumps(properties)})
|
||||
'properties': json.dumps(properties)})
|
||||
except KeyError:
|
||||
pass
|
||||
html = TRACKING_CODE % {'token': self.token,
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ Olark template tags.
|
|||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils import simplejson
|
||||
|
||||
from analytical.utils import get_identity, get_required_setting
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ class OlarkNode(Node):
|
|||
extra_code.append(NICKNAME_CODE % identity)
|
||||
try:
|
||||
extra_code.append(STATUS_CODE %
|
||||
simplejson.dumps(context[STATUS_CONTEXT_KEY]))
|
||||
json.dumps(context[STATUS_CONTEXT_KEY]))
|
||||
except KeyError:
|
||||
pass
|
||||
extra_code.extend(self._get_configuration(context))
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ Reinvigorate template tags and filters.
|
|||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils import simplejson
|
||||
|
||||
from analytical.utils import get_identity, is_internal_ip, disable_html, \
|
||||
get_required_setting
|
||||
|
|
@ -65,7 +65,7 @@ class ReinvigorateNode(Node):
|
|||
email = get_identity(context, 'reinvigorate', lambda u: u.email)
|
||||
if email is not None:
|
||||
re_vars['context'] = email
|
||||
tags = " ".join("var re_%s_tag = %s;" % (tag, simplejson.dumps(value))
|
||||
tags = " ".join("var re_%s_tag = %s;" % (tag, json.dumps(value))
|
||||
for tag, value in re_vars.items())
|
||||
|
||||
html = TRACKING_CODE % {'tracking_id': self.tracking_id,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ from __future__ import absolute_import
|
|||
import re
|
||||
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils import simplejson
|
||||
|
||||
from analytical.utils import get_identity, is_internal_ip, disable_html, \
|
||||
get_required_setting
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ UserVoice template tags.
|
|||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
from django.template import Library, Node, TemplateSyntaxError, Variable
|
||||
from django.utils import simplejson
|
||||
|
||||
from analytical.utils import get_identity, get_required_setting
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ class UserVoiceNode(Node):
|
|||
# Enable SSO
|
||||
pass
|
||||
html = TRACKING_CODE % {'widget_key': widget_key,
|
||||
'options': simplejson.dumps(options)}
|
||||
'options': json.dumps(options)}
|
||||
return html
|
||||
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ class UserVoiceKeyLinkNode(Node):
|
|||
vars = {}
|
||||
if self.widget_key:
|
||||
vars['widget_key'] = self.widget_key.resolve(context)
|
||||
return LINK_CODE % simplejson.dumps(vars)
|
||||
return LINK_CODE % json.dumps(vars)
|
||||
|
||||
|
||||
def contribute_to_analytical(add_node):
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ Woopra template tags and filters.
|
|||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
from django.conf import settings
|
||||
from django.template import Library, Node, TemplateSyntaxError
|
||||
from django.utils import simplejson
|
||||
|
||||
from analytical.utils import get_identity, get_user_from_context, \
|
||||
is_internal_ip, disable_html, get_required_setting
|
||||
|
|
@ -57,8 +57,8 @@ class WoopraNode(Node):
|
|||
visitor = self._get_visitor(context)
|
||||
|
||||
html = TRACKING_CODE % {
|
||||
'settings': simplejson.dumps(settings),
|
||||
'visitor': simplejson.dumps(visitor),
|
||||
'settings': json.dumps(settings),
|
||||
'visitor': json.dumps(visitor),
|
||||
}
|
||||
if is_internal_ip(context, 'WOOPRA'):
|
||||
html = disable_html(html, 'Woopra')
|
||||
|
|
|
|||
Loading…
Reference in a new issue