Skip to content

Commit

Permalink
Fixed i18n bug with lazy, worked on google analytic code extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Haineault committed May 7, 2013
1 parent ef8c56d commit f744e2e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions seoutils/models.py
Expand Up @@ -3,7 +3,7 @@
import re

from django.db import models
from django.utils.translation import gettext_lazy as _
from django.utils.translation import gettext as _

CONTENT_TYPE_CHOICES = (
('text/plain', _('Plain text')),
Expand Down Expand Up @@ -48,11 +48,12 @@ class Analytic(models.Model):
is_active = models.BooleanField(_('Is active'), default=True)

def __unicode__(self):
regex = re.compile("('UA-.*')")
regex = re.compile("""(['"]UA-.*['"])""")
try:
return regex.findall(self.code)[0].replace("'", '')
return regex.findall(self.code)[0].replace("'", '').replace('"', '')
except:
return _('Unknown analytic code')
return _('Unknown analytic code')


class VirtualFile(models.Model):
Expand Down

0 comments on commit f744e2e

Please sign in to comment.