clean out some python2-isms
This commit is contained in:
@ -1,5 +1,3 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import F
|
from django.db.models import F
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from wagtail_personalisation import models, rules
|
from wagtail_personalisation import models, rules
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from wagtail_personalisation import views
|
from wagtail_personalisation import views
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from wagtail.core import blocks
|
from wagtail.core import blocks
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import re
|
import re
|
||||||
@ -13,7 +12,6 @@ from django.db import models
|
|||||||
from django.template.defaultfilters import slugify
|
from django.template.defaultfilters import slugify
|
||||||
from django.test.client import RequestFactory
|
from django.test.client import RequestFactory
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from modelcluster.fields import ParentalKey
|
from modelcluster.fields import ParentalKey
|
||||||
from user_agents import parse
|
from user_agents import parse
|
||||||
@ -43,7 +41,6 @@ def get_geoip_module():
|
|||||||
'warning if you use one of those.')
|
'warning if you use one of those.')
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class AbstractBaseRule(models.Model):
|
class AbstractBaseRule(models.Model):
|
||||||
"""Base for creating rules to segment users with."""
|
"""Base for creating rules to segment users with."""
|
||||||
icon = 'fa-circle-o'
|
icon = 'fa-circle-o'
|
||||||
@ -59,7 +56,7 @@ class AbstractBaseRule(models.Model):
|
|||||||
verbose_name = 'Abstract segmentation rule'
|
verbose_name = 'Abstract segmentation rule'
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return force_text(self._meta.verbose_name)
|
return str(self._meta.verbose_name)
|
||||||
|
|
||||||
def test_user(self):
|
def test_user(self):
|
||||||
"""Test if the user matches this rule."""
|
"""Test if the user matches this rule."""
|
||||||
@ -67,7 +64,7 @@ class AbstractBaseRule(models.Model):
|
|||||||
|
|
||||||
def encoded_name(self):
|
def encoded_name(self):
|
||||||
"""Return a string with a slug for the rule."""
|
"""Return a string with a slug for the rule."""
|
||||||
return slugify(force_text(self).lower())
|
return slugify(str(self).lower())
|
||||||
|
|
||||||
def description(self):
|
def description(self):
|
||||||
"""Return a description explaining the functionality of the rule.
|
"""Return a description explaining the functionality of the rule.
|
||||||
|
Reference in New Issue
Block a user