Skip to content

Commit

Permalink
Fix proxy objects
Browse files Browse the repository at this point in the history
  • Loading branch information
f1nality committed Sep 21, 2015
1 parent bf91e3c commit ac83763
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions jet/dashboard/dashboard_modules/google_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from oauth2client.client import flow_from_clientsecrets, OAuth2Credentials, AccessTokenRefreshError, Storage
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.utils.encoding import force_text

try:
from django.utils.encoding import force_unicode
Expand Down Expand Up @@ -140,12 +141,12 @@ def render(self, name, value, attrs=None):
if value and len(value) > 0:
link = '<a href="%s">%s</a>' % (
reverse('jet-dashboard:google-analytics-revoke', kwargs={'pk': self.module.model.pk}),
_('Revoke access')
force_text(_('Revoke access'))
)
else:
link = '<a href="%s">%s</a>' % (
reverse('jet-dashboard:google-analytics-grant', kwargs={'pk': self.module.model.pk}),
_('Grant access')
force_text(_('Grant access'))
)

attrs = self.build_attrs({
Expand Down Expand Up @@ -175,10 +176,10 @@ def set_module(self, module):
def set_counter_choices(self, module):
counters = module.counters()
if counters is not None:
self.fields['counter'].choices = (('', '-- %s --' % _('none')),)
self.fields['counter'].choices = (('', '-- %s --' % force_text(_('none'))),)
self.fields['counter'].choices.extend(map(lambda x: (x['id'], x['websiteUrl']), counters))
else:
label = _('grant access first') if module.credential is None else _('counters loading failed')
label = force_text(_('grant access first')) if module.credential is None else force_text(_('counters loading failed'))
self.fields['counter'].choices = (('', '-- %s -- ' % label),)


Expand Down
9 changes: 5 additions & 4 deletions jet/dashboard/dashboard_modules/yandex_metrika.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from jet.dashboard.modules import DashboardModule
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.utils.encoding import force_text

try:
from urllib import request
Expand Down Expand Up @@ -98,12 +99,12 @@ def render(self, name, value, attrs=None):
if value and len(value) > 0:
link = '<a href="%s">%s</a>' % (
reverse('jet-dashboard:yandex-metrika-revoke', kwargs={'pk': self.module.model.pk}),
_('Revoke access')
force_text(_('Revoke access'))
)
else:
link = '<a href="%s">%s</a>' % (
reverse('jet-dashboard:yandex-metrika-grant', kwargs={'pk': self.module.model.pk}),
_('Grant access')
force_text(_('Grant access'))
)

if value is None:
Expand All @@ -130,10 +131,10 @@ def set_module(self, module):
def set_counter_choices(self, module):
counters = module.counters()
if counters is not None:
self.fields['counter'].choices = (('', '-- %s --' % _('none')),)
self.fields['counter'].choices = (('', '-- %s --' % force_text(_('none'))),)
self.fields['counter'].choices.extend(map(lambda x: (x['id'], x['site']), counters))
else:
label = _('grant access first') if module.access_token is None else _('counters loading failed')
label = force_text(_('grant access first')) if module.access_token is None else force_text(_('counters loading failed'))
self.fields['counter'].choices = (('', '-- %s -- ' % label),)


Expand Down

0 comments on commit ac83763

Please sign in to comment.