Replace all instances of unicode only handling to use force_text.
Replace all __unicode__ methods to __str__ and the @python_2_unicode_compatible decorator. Replace all instance of smart_str, smart_unicode, force_uncode with force_text. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import logging
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from permissions.models import Role, StoredPermission
|
||||
@@ -68,7 +68,7 @@ class AccessControlList(models.Model):
|
||||
|
||||
def get_permission_titles(self):
|
||||
result = ', '.join(
|
||||
[unicode(permission) for permission in self.permissions.all()]
|
||||
[force_text(permission) for permission in self.permissions.all()]
|
||||
)
|
||||
|
||||
return result or _('None')
|
||||
|
||||
@@ -7,6 +7,7 @@ from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import Http404, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.views import (
|
||||
@@ -156,7 +157,7 @@ class ACLPermissionsView(AssignRemoveView):
|
||||
|
||||
for namespace, permissions in itertools.groupby(entries, lambda entry: entry.namespace):
|
||||
permission_options = [
|
||||
(unicode(permission.pk), permission) for permission in permissions
|
||||
(force_text(permission.pk), permission) for permission in permissions
|
||||
]
|
||||
results.append(
|
||||
(PermissionNamespace.get(namespace), permission_options)
|
||||
|
||||
@@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
|
||||
import pytz
|
||||
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from rest_framework import generics, status
|
||||
from rest_framework.response import Response
|
||||
@@ -76,7 +77,7 @@ class APICheckedoutDocumentListView(generics.ListCreateAPIView):
|
||||
)
|
||||
except Exception as exception:
|
||||
return Response(
|
||||
data={'exception': unicode(exception)},
|
||||
data={'exception': force_text(exception)},
|
||||
status=status.HTTP_400_BAD_REQUEST
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext
|
||||
|
||||
|
||||
@@ -17,11 +18,12 @@ class DocumentNotCheckedOut(DocumentCheckoutError):
|
||||
pass
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class DocumentAlreadyCheckedOut(DocumentCheckoutError):
|
||||
"""
|
||||
Raised when trying to checkout an already checkedout document
|
||||
"""
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return ugettext('Document already checked out.')
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.conf import settings
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
@@ -46,7 +46,7 @@ class DocumentCheckout(models.Model):
|
||||
objects = DocumentCheckoutManager()
|
||||
|
||||
def __str__(self):
|
||||
return unicode(self.document)
|
||||
return force_text(self.document)
|
||||
|
||||
def clean(self):
|
||||
if self.expiration_datetime < now():
|
||||
|
||||
@@ -3,9 +3,11 @@ from __future__ import unicode_literals
|
||||
from django.apps import apps
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import models
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Collection(object):
|
||||
_registry = []
|
||||
|
||||
@@ -22,8 +24,8 @@ class Collection(object):
|
||||
self._order = order or 99
|
||||
self.__class__._registry.append(self)
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.label)
|
||||
def __str__(self):
|
||||
return force_text(self.label)
|
||||
|
||||
def resolve(self):
|
||||
self.children = self._get_children()
|
||||
@@ -61,6 +63,7 @@ class DashboardWidget(object):
|
||||
self.__class__._registry.append(self)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class ModelAttribute(object):
|
||||
__registry = {}
|
||||
|
||||
@@ -98,7 +101,7 @@ class ModelAttribute(object):
|
||||
for count, attribute in enumerate(cls.get_for(model, type_names), 1):
|
||||
result.append(
|
||||
'{}) {}'.format(
|
||||
count, unicode(attribute.get_display(show_name=True))
|
||||
count, force_text(attribute.get_display(show_name=True))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -112,9 +115,9 @@ class ModelAttribute(object):
|
||||
self.name if show_name else self.label, self.description
|
||||
)
|
||||
else:
|
||||
return unicode(self.name if show_name else self.label)
|
||||
return force_text(self.name if show_name else self.label)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return self.get_display()
|
||||
|
||||
def __init__(self, model, name, label=None, description=None, type_name=None):
|
||||
@@ -154,6 +157,7 @@ class MissingItem(object):
|
||||
self.__class__._registry.append(self)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Filter(object):
|
||||
_registry = {}
|
||||
|
||||
@@ -175,8 +179,8 @@ class Filter(object):
|
||||
|
||||
self.__class__._registry[self.slug] = self
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.label)
|
||||
def __str__(self):
|
||||
return force_text(self.label)
|
||||
|
||||
def get_queryset(self, user):
|
||||
AccessControlList = apps.get_model(
|
||||
|
||||
@@ -4,6 +4,7 @@ from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.views.generic import (
|
||||
FormView as DjangoFormView, DetailView, TemplateView
|
||||
@@ -56,7 +57,7 @@ class AssignRemoveView(ExtraContextMixin, ViewPermissionCheckMixin, ObjectPermis
|
||||
results = []
|
||||
for choice in choices:
|
||||
ct = ContentType.objects.get_for_model(choice)
|
||||
label = unicode(choice)
|
||||
label = force_text(choice)
|
||||
|
||||
results.append(('%s,%s' % (ct.model, choice.pk), '%s' % (label)))
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from pytz import common_timezones
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .runtime import shared_storage_backend
|
||||
@@ -35,7 +35,7 @@ class SharedUploadedFile(models.Model):
|
||||
return self.filename
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.filename = unicode(self.file)
|
||||
self.filename = force_text(self.file)
|
||||
super(SharedUploadedFile, self).save(*args, **kwargs)
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
@@ -61,7 +61,7 @@ class UserLocaleProfile(models.Model):
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return unicode(self.user)
|
||||
return force_text(self.user)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('User locale profile')
|
||||
|
||||
@@ -7,6 +7,7 @@ import sh
|
||||
from django.conf import settings
|
||||
from django.template import Context, Library
|
||||
from django.template.loader import get_template
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
import mayan
|
||||
|
||||
@@ -101,4 +102,4 @@ def build():
|
||||
|
||||
@register.filter
|
||||
def get_type(value):
|
||||
return unicode(type(value))
|
||||
return force_text(type(value))
|
||||
|
||||
@@ -11,6 +11,7 @@ from django.conf import settings
|
||||
from django.core.urlresolvers import resolve as django_resolve
|
||||
from django.urls.base import get_script_prefix
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.http import urlquote as django_urlquote
|
||||
from django.utils.http import urlencode as django_urlencode
|
||||
|
||||
@@ -136,7 +137,7 @@ def return_attrib(obj, attrib, arguments=None):
|
||||
if settings.DEBUG:
|
||||
return 'Attribute error: %s; %s' % (attrib, exception)
|
||||
else:
|
||||
return unicode(exception)
|
||||
return force_text(exception)
|
||||
|
||||
|
||||
def urlquote(link=None, get=None):
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django import forms
|
||||
from django.forms.utils import flatatt
|
||||
from django.utils.encoding import force_unicode, force_text
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.html import conditional_escape, format_html
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
@@ -122,7 +122,7 @@ class TextAreaDiv(forms.widgets.Widget):
|
||||
value = ''
|
||||
|
||||
flat_attrs = flatatt(self.build_attrs(attrs, name=name))
|
||||
content = conditional_escape(force_unicode(value))
|
||||
content = conditional_escape(force_text(value))
|
||||
result = '<pre%s>%s</pre>' % (flat_attrs, content)
|
||||
return mark_safe(result)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common import MayanAppConfig, menu_object, menu_sidebar
|
||||
@@ -26,7 +27,7 @@ class ConverterApp(MayanAppConfig):
|
||||
SourceColumn(source=Transformation, label=_('Order'), attribute='order')
|
||||
SourceColumn(
|
||||
source=Transformation, label=_('Transformation'),
|
||||
func=lambda context: unicode(context['object'])
|
||||
func=lambda context: force_text(context['object'])
|
||||
)
|
||||
SourceColumn(
|
||||
source=Transformation, label=_('Arguments'), attribute='arguments'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from django import forms
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.classes import ModelAttribute
|
||||
@@ -27,7 +28,7 @@ class IndexTemplateNodeForm(forms.ModelForm):
|
||||
self.fields['parent'].widget = forms.widgets.HiddenInput()
|
||||
self.fields['expression'].help_text = ' '.join(
|
||||
[
|
||||
unicode(self.fields['expression'].help_text),
|
||||
force_text(self.fields['expression'].help_text),
|
||||
ModelAttribute.help_text_for(
|
||||
Document, type_names=['indexing']
|
||||
).replace('\n', '<br>')
|
||||
|
||||
@@ -5,7 +5,7 @@ import logging
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import models, transaction
|
||||
from django.template import Context, Template
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext, ugettext_lazy as _
|
||||
|
||||
from mptt.fields import TreeForeignKey
|
||||
@@ -81,7 +81,7 @@ class Index(models.Model):
|
||||
def get_document_types_names(self):
|
||||
return ', '.join(
|
||||
[
|
||||
unicode(document_type) for document_type in self.document_types.all()
|
||||
force_text(document_type) for document_type in self.document_types.all()
|
||||
] or ['None']
|
||||
)
|
||||
|
||||
@@ -314,9 +314,9 @@ class IndexInstanceNode(MPTTModel):
|
||||
result = []
|
||||
for node in self.get_ancestors(include_self=True):
|
||||
if node.is_root_node():
|
||||
result.append(unicode(self.index()))
|
||||
result.append(force_text(self.index()))
|
||||
else:
|
||||
result.append(unicode(node))
|
||||
result.append(force_text(node))
|
||||
|
||||
return ' / '.join(result)
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.apps import apps
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.html import mark_safe, escape
|
||||
|
||||
|
||||
@@ -50,7 +51,7 @@ def node_level(node):
|
||||
[
|
||||
' ' * node.get_level(),
|
||||
'' if node.is_root_node() else '<i class="fa fa-level-up fa-rotate-90"></i> ',
|
||||
unicode(node)
|
||||
force_text(node)
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import uuid
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from model_utils.managers import InheritanceManager
|
||||
@@ -21,7 +21,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def upload_to(*args, **kwargs):
|
||||
return unicode(uuid.uuid4())
|
||||
return force_text(uuid.uuid4())
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
||||
@@ -7,6 +7,7 @@ from django.core.files import File
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from acls.models import AccessControlList
|
||||
@@ -284,7 +285,7 @@ class DocumentVersionSignatureDownloadView(SingleObjectDownloadView):
|
||||
signature = self.get_object()
|
||||
|
||||
return DocumentVersionSignatureDownloadView.VirtualFile(
|
||||
signature.signature_file, name=unicode(signature)
|
||||
signature.signature_file, name=force_text(signature)
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.conf import settings
|
||||
from django.core.exceptions import PermissionDenied, ValidationError
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import IntegrityError, models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from acls.models import AccessControlList
|
||||
@@ -159,7 +159,7 @@ class WorkflowInstance(models.Model):
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return unicode(self.workflow)
|
||||
return force_text(self.workflow)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse(
|
||||
@@ -277,7 +277,7 @@ class WorkflowInstanceLogEntry(models.Model):
|
||||
comment = models.TextField(blank=True, verbose_name=_('Comment'))
|
||||
|
||||
def __str__(self):
|
||||
return unicode(self.transition)
|
||||
return force_text(self.transition)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Workflow instance log entry')
|
||||
|
||||
@@ -4,6 +4,7 @@ import logging
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from django_downloadview import DownloadMixin, VirtualFile
|
||||
from rest_framework import generics, status
|
||||
@@ -198,7 +199,7 @@ class APIDocumentVersionDownloadView(DownloadMixin, generics.RetrieveAPIView):
|
||||
|
||||
def get_file(self):
|
||||
instance = self.get_object()
|
||||
return VirtualFile(instance.file, name=unicode(instance))
|
||||
return VirtualFile(instance.file, name=force_text(instance))
|
||||
|
||||
def get_serializer_class(self):
|
||||
return None
|
||||
|
||||
@@ -8,7 +8,7 @@ from django.conf import settings
|
||||
from django.core.files import File
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import models, transaction
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext, ugettext_lazy as _
|
||||
|
||||
@@ -52,7 +52,7 @@ def HASH_FUNCTION(data):
|
||||
|
||||
|
||||
def UUID_FUNCTION(*args, **kwargs):
|
||||
return unicode(uuid.uuid4())
|
||||
return force_text(uuid.uuid4())
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
@@ -433,7 +433,7 @@ class DocumentVersion(models.Model):
|
||||
|
||||
self.document.is_stub = False
|
||||
if not self.document.label:
|
||||
self.document.label = unicode(self.file)
|
||||
self.document.label = force_text(self.file)
|
||||
|
||||
self.document.save()
|
||||
except Exception as exception:
|
||||
@@ -584,7 +584,7 @@ class DocumentVersion(models.Model):
|
||||
"""
|
||||
if self.exists():
|
||||
source = self.open()
|
||||
self.checksum = unicode(HASH_FUNCTION(source.read()))
|
||||
self.checksum = force_text(HASH_FUNCTION(source.read()))
|
||||
source.close()
|
||||
if save:
|
||||
self.save()
|
||||
@@ -682,7 +682,7 @@ class DocumentPage(models.Model):
|
||||
return _(
|
||||
'Page %(page_num)d out of %(total_pages)d of %(document)s'
|
||||
) % {
|
||||
'document': unicode(self.document),
|
||||
'document': force_text(self.document),
|
||||
'page_num': self.page_number,
|
||||
'total_pages': self.document_version.pages.count()
|
||||
}
|
||||
@@ -881,7 +881,7 @@ class RecentDocument(models.Model):
|
||||
objects = RecentDocumentManager()
|
||||
|
||||
def __str__(self):
|
||||
return unicode(self.document)
|
||||
return force_text(self.document)
|
||||
|
||||
def natural_key(self):
|
||||
return self.document.natural_key() + self.user.natural_key()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from rest_framework import serializers
|
||||
from rest_framework.reverse import reverse
|
||||
|
||||
@@ -281,7 +283,7 @@ class NewDocumentSerializer(serializers.ModelSerializer):
|
||||
description=self.validated_data.get('description', ''),
|
||||
document_type=self.validated_data['document_type'],
|
||||
label=self.validated_data.get(
|
||||
'label', unicode(self.validated_data['file'])
|
||||
'label', force_text(self.validated_data['file'])
|
||||
),
|
||||
language=self.validated_data.get(
|
||||
'language', setting_language.value
|
||||
|
||||
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.test import override_settings
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from common.tests.test_views import GenericViewTestCase
|
||||
from converter.models import Transformation
|
||||
@@ -482,7 +483,7 @@ class DocumentsViewsTestCase(GenericDocumentViewTestCase):
|
||||
)
|
||||
|
||||
self.assertContains(
|
||||
response, unicode(self.document.pages.first()), status_code=200
|
||||
response, force_text(self.document.pages.first()), status_code=200
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ from django.core.exceptions import PermissionDenied
|
||||
from django.core.urlresolvers import reverse, reverse_lazy
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.translation import ugettext_lazy as _, ungettext
|
||||
|
||||
@@ -454,7 +455,7 @@ class DocumentDownloadView(SingleObjectDownloadView):
|
||||
if isinstance(item, Document):
|
||||
return item.label
|
||||
else:
|
||||
return unicode(item)
|
||||
return force_text(item)
|
||||
|
||||
def get_document_queryset(self):
|
||||
id_list = self.request.GET.get(
|
||||
|
||||
@@ -2,6 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django import forms
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.html import strip_tags
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.safestring import mark_safe
|
||||
@@ -308,7 +309,7 @@ class DocumentThumbnailWidget(BaseDocumentThumbnailWidget):
|
||||
|
||||
class DocumentPageThumbnailWidget(BaseDocumentThumbnailWidget):
|
||||
def get_title(self, instance):
|
||||
return unicode(instance)
|
||||
return force_text(instance)
|
||||
|
||||
|
||||
class InteractiveDocumentPageWidget(BaseDocumentThumbnailWidget):
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from rest_framework import generics
|
||||
from rest_framework.exceptions import ParseError
|
||||
|
||||
@@ -40,7 +42,7 @@ class APISearchView(SearchModelMixin, generics.ListAPIView):
|
||||
query_string=self.request.GET, user=self.request.user
|
||||
)
|
||||
except Exception as exception:
|
||||
raise ParseError(unicode(exception))
|
||||
raise ParseError(force_text(exception))
|
||||
|
||||
return queryset
|
||||
|
||||
@@ -83,7 +85,7 @@ class APIAdvancedSearchView(SearchModelMixin, generics.ListAPIView):
|
||||
global_and_search=global_and_search
|
||||
)
|
||||
except Exception as exception:
|
||||
raise ParseError(unicode(exception))
|
||||
raise ParseError(force_text(exception))
|
||||
|
||||
return queryset
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import re
|
||||
|
||||
from django.apps import apps
|
||||
from django.db.models import Q
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.module_loading import import_string
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
@@ -220,7 +221,7 @@ class SearchModel(object):
|
||||
|
||||
result_set = result_set | model_result_set
|
||||
|
||||
elapsed_time = unicode(
|
||||
elapsed_time = force_text(
|
||||
datetime.datetime.now() - start_time
|
||||
).split(':')[2]
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.http import Http404
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from .classes import SearchModel
|
||||
|
||||
@@ -10,4 +11,4 @@ class SearchModelMixin(object):
|
||||
try:
|
||||
return SearchModel.get(self.kwargs['search_model'])
|
||||
except KeyError as exception:
|
||||
raise Http404(unicode(exception))
|
||||
raise Http404(force_text(exception))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.apps import apps
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from actstream import action
|
||||
@@ -27,7 +28,7 @@ class Event(object):
|
||||
try:
|
||||
return cls.get(name=name).label
|
||||
except KeyError as exception:
|
||||
return unicode(exception)
|
||||
return force_text(exception)
|
||||
|
||||
def __init__(self, name, label):
|
||||
self.name = name
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django import forms
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.classes import ModelAttribute
|
||||
@@ -14,7 +15,7 @@ class SmartLinkForm(forms.ModelForm):
|
||||
super(SmartLinkForm, self).__init__(*args, **kwargs)
|
||||
self.fields['dynamic_label'].help_text = ' '.join(
|
||||
[
|
||||
unicode(self.fields['dynamic_label'].help_text),
|
||||
force_text(self.fields['dynamic_label'].help_text),
|
||||
ModelAttribute.help_text_for(
|
||||
Document, type_names=['field', 'related', 'property']
|
||||
).replace('\n', '<br>')
|
||||
@@ -36,7 +37,7 @@ class SmartLinkConditionForm(forms.ModelForm):
|
||||
)
|
||||
self.fields['expression'].help_text = ' '.join(
|
||||
[
|
||||
unicode(self.fields['expression'].help_text),
|
||||
force_text(self.fields['expression'].help_text),
|
||||
ModelAttribute.help_text_for(
|
||||
Document, type_names=['field', 'related', 'property']
|
||||
).replace('\n', '<br>')
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
||||
from django.db import models
|
||||
from django.db.models import Q
|
||||
from django.template import Context, Template
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from documents.models import Document, DocumentType
|
||||
@@ -43,7 +43,9 @@ class SmartLink(models.Model):
|
||||
return template.render(context=context)
|
||||
except Exception as exception:
|
||||
return _(
|
||||
'Error generating dynamic label; %s' % unicode(exception)
|
||||
'Error generating dynamic label; %s' % force_text(
|
||||
exception
|
||||
)
|
||||
)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -160,7 +160,7 @@ class DocumentMetadata(models.Model):
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return unicode(self.metadata_type)
|
||||
return force_text(self.metadata_type)
|
||||
|
||||
def delete(self, enforce_required=True, *args, **kwargs):
|
||||
if enforce_required and self.metadata_type.pk in self.document.document_type.metadata.filter(required=True).values_list('metadata_type', flat=True):
|
||||
@@ -209,7 +209,7 @@ class DocumentTypeMetadataType(models.Model):
|
||||
required = models.BooleanField(default=False, verbose_name=_('Required'))
|
||||
|
||||
def __str__(self):
|
||||
return unicode(self.metadata_type)
|
||||
return force_text(self.metadata_type)
|
||||
|
||||
class Meta:
|
||||
unique_together = ('document_type', 'metadata_type')
|
||||
|
||||
@@ -313,7 +313,7 @@ class DocumentMetadataEditView(MultipleObjectFormActionView):
|
||||
if isinstance(error, ValidationError):
|
||||
exception_message = ', '.join(error.messages)
|
||||
else:
|
||||
exception_message = unicode(error)
|
||||
exception_message = force_text(error)
|
||||
|
||||
messages.error(
|
||||
self.request, _(
|
||||
|
||||
@@ -11,7 +11,7 @@ from django.core.exceptions import PermissionDenied
|
||||
from django.core.urlresolvers import resolve, reverse
|
||||
from django.template import VariableDoesNotExist, Variable
|
||||
from django.template.defaulttags import URLNode
|
||||
from django.utils.encoding import force_text, smart_str, smart_unicode
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.http import urlencode, urlquote
|
||||
|
||||
from common.utils import return_attrib
|
||||
@@ -351,11 +351,11 @@ class Link(object):
|
||||
# Lets a new link keep the same URL query string of the current URL
|
||||
if self.keep_query:
|
||||
# Sometimes we are required to remove a key from the URL QS
|
||||
previous_path = smart_unicode(
|
||||
previous_path = force_text(
|
||||
urllib.unquote_plus(
|
||||
smart_str(
|
||||
force_text(
|
||||
request.get_full_path()
|
||||
) or smart_str(
|
||||
) or force_text(
|
||||
request.META.get(
|
||||
'HTTP_REFERER',
|
||||
reverse(settings.LOGIN_REDIRECT_URL)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django import forms
|
||||
from django.utils.encoding import force_unicode
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.html import conditional_escape
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import ugettext_lazy as _, ugettext
|
||||
@@ -33,7 +33,7 @@ class DocumentContentForm(forms.Form):
|
||||
except DocumentPageContent.DoesNotExist:
|
||||
pass
|
||||
else:
|
||||
content.append(conditional_escape(force_unicode(page_content)))
|
||||
content.append(conditional_escape(force_text(page_content)))
|
||||
content.append(
|
||||
'\n\n\n<hr/><div class="document-page-content-divider">- %s -</div><hr/>\n\n\n' % (
|
||||
ugettext(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from documents.models import DocumentPage, DocumentType, DocumentVersion
|
||||
@@ -37,7 +37,7 @@ class DocumentVersionOCRError(models.Model):
|
||||
result = models.TextField(blank=True, null=True, verbose_name=_('Result'))
|
||||
|
||||
def __str__(self):
|
||||
return unicode(self.document_version)
|
||||
return force_text(self.document_version)
|
||||
|
||||
class Meta:
|
||||
ordering = ('datetime_submitted',)
|
||||
@@ -57,7 +57,7 @@ class DocumentPageContent(models.Model):
|
||||
content = models.TextField(blank=True, verbose_name=_('Content'))
|
||||
|
||||
def __str__(self):
|
||||
return unicode(self.document_page)
|
||||
return force_text(self.document_page)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Document page content')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.encoding import force_unicode
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.html import conditional_escape
|
||||
|
||||
|
||||
@@ -11,4 +11,4 @@ def get_document_ocr_content(document):
|
||||
except DocumentPageContent.DoesNotExist:
|
||||
pass
|
||||
else:
|
||||
yield conditional_escape(force_unicode(page_content))
|
||||
yield conditional_escape(force_text(page_content))
|
||||
|
||||
@@ -4,6 +4,7 @@ import logging
|
||||
|
||||
from django.apps import apps
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .exceptions import InvalidNamespace
|
||||
@@ -11,6 +12,7 @@ from .exceptions import InvalidNamespace
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class PermissionNamespace(object):
|
||||
_registry = {}
|
||||
|
||||
@@ -35,8 +37,8 @@ class PermissionNamespace(object):
|
||||
self.permissions = []
|
||||
self.__class__._registry[name] = self
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.label)
|
||||
def __str__(self):
|
||||
return force_text(self.label)
|
||||
|
||||
def add_permission(self, name, label):
|
||||
permission = Permission(namespace=self, name=name, label=label)
|
||||
@@ -44,6 +46,7 @@ class PermissionNamespace(object):
|
||||
return permission
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Permission(object):
|
||||
_permissions = {}
|
||||
_stored_permissions_cache = {}
|
||||
@@ -105,11 +108,8 @@ class Permission(object):
|
||||
def __repr__(self):
|
||||
return self.pk
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.label)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.__unicode__())
|
||||
return force_text(self.label)
|
||||
|
||||
@property
|
||||
def stored_permission(self):
|
||||
|
||||
@@ -5,7 +5,7 @@ import logging
|
||||
from django.contrib.auth.models import Group
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .classes import Permission
|
||||
@@ -34,7 +34,7 @@ class StoredPermission(models.Model):
|
||||
pass
|
||||
|
||||
def __str__(self):
|
||||
return unicode(getattr(self, 'volatile_permission', self.name))
|
||||
return force_text(getattr(self, 'volatile_permission', self.name))
|
||||
|
||||
def natural_key(self):
|
||||
return (self.namespace, self.name)
|
||||
|
||||
@@ -5,6 +5,7 @@ import itertools
|
||||
from django.contrib.auth.models import Group
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common.views import (
|
||||
@@ -61,12 +62,12 @@ class SetupRoleMembersView(AssignRemoveView):
|
||||
|
||||
def left_list(self):
|
||||
return [
|
||||
(unicode(group.pk), group.name) for group in set(Group.objects.all()) - set(self.get_object().groups.all())
|
||||
(force_text(group.pk), group.name) for group in set(Group.objects.all()) - set(self.get_object().groups.all())
|
||||
]
|
||||
|
||||
def right_list(self):
|
||||
return [
|
||||
(unicode(group.pk), group.name) for group in self.get_object().groups.all()
|
||||
(force_text(group.pk), group.name) for group in self.get_object().groups.all()
|
||||
]
|
||||
|
||||
def remove(self, item):
|
||||
@@ -102,7 +103,7 @@ class SetupRolePermissionsView(AssignRemoveView):
|
||||
|
||||
for namespace, permissions in itertools.groupby(StoredPermission.objects.exclude(id__in=self.get_object().permissions.values_list('pk', flat=True)), lambda entry: entry.namespace):
|
||||
permission_options = [
|
||||
(unicode(permission.pk), permission) for permission in permissions
|
||||
(force_text(permission.pk), permission) for permission in permissions
|
||||
]
|
||||
results.append(
|
||||
(PermissionNamespace.get(namespace), permission_options)
|
||||
@@ -114,7 +115,7 @@ class SetupRolePermissionsView(AssignRemoveView):
|
||||
results = []
|
||||
for namespace, permissions in itertools.groupby(self.get_object().permissions.all(), lambda entry: entry.namespace):
|
||||
permission_options = [
|
||||
(unicode(permission.pk), permission) for permission in permissions
|
||||
(force_text(permission.pk), permission) for permission in permissions
|
||||
]
|
||||
results.append(
|
||||
(PermissionNamespace.get(namespace), permission_options)
|
||||
|
||||
@@ -2,9 +2,11 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.conf.urls import include, url
|
||||
from django.conf import settings
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.module_loading import import_string
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class APIEndPoint(object):
|
||||
_registry = {}
|
||||
|
||||
@@ -16,8 +18,8 @@ class APIEndPoint(object):
|
||||
def get(cls, name):
|
||||
return cls._registry[name]
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.app.name)
|
||||
def __str__(self):
|
||||
return force_text(self.app.name)
|
||||
|
||||
def __init__(self, app, version_string, name=None):
|
||||
self.app = app
|
||||
|
||||
@@ -9,11 +9,12 @@ import yaml
|
||||
from django.apps import apps
|
||||
from django.conf import settings
|
||||
from django.utils.functional import Promise
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Namespace(object):
|
||||
_registry = {}
|
||||
|
||||
@@ -42,8 +43,8 @@ class Namespace(object):
|
||||
for namespace in cls.get_all():
|
||||
namespace.invalidate_cache()
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.label)
|
||||
def __str__(self):
|
||||
return force_text(self.label)
|
||||
|
||||
def __init__(self, name, label):
|
||||
if name in self.__class__._registry:
|
||||
@@ -63,6 +64,7 @@ class Namespace(object):
|
||||
setting.invalidate_cache()
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Setting(object):
|
||||
_registry = {}
|
||||
|
||||
@@ -89,8 +91,8 @@ class Setting(object):
|
||||
namespace.settings.append(self)
|
||||
self.__class__._registry[global_name] = self
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.global_name)
|
||||
def __str__(self):
|
||||
return force_text(self.global_name)
|
||||
|
||||
def cache_value(self):
|
||||
environment_value = os.environ.get('MAYAN_{}'.format(self.global_name))
|
||||
|
||||
@@ -11,6 +11,7 @@ except ImportError:
|
||||
from StringIO import StringIO
|
||||
|
||||
from django.core.files import File
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
|
||||
from converter import TransformationResize, converter_class
|
||||
|
||||
@@ -39,6 +40,7 @@ class Attachment(File):
|
||||
)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class StagingFile(object):
|
||||
"""
|
||||
Simple class to extend the File class to add preview capabilities
|
||||
@@ -57,8 +59,8 @@ class StagingFile(object):
|
||||
filename.encode('utf8')
|
||||
)
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.filename)
|
||||
def __str__(self):
|
||||
return force_text(self.filename)
|
||||
|
||||
def as_file(self):
|
||||
return File(
|
||||
|
||||
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
||||
import logging
|
||||
|
||||
from django import forms
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.translation import ugettext
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
@@ -59,7 +60,7 @@ class StagingUploadForm(UploadBaseForm):
|
||||
|
||||
try:
|
||||
self.fields['staging_file_id'].choices = [
|
||||
(staging_file.encoded_filename, unicode(staging_file)) for staging_file in self.source.get_files()
|
||||
(staging_file.encoded_filename, force_text(staging_file)) for staging_file in self.source.get_files()
|
||||
]
|
||||
except Exception as exception:
|
||||
logger.error('exception: %s', exception)
|
||||
|
||||
@@ -22,7 +22,7 @@ from django.core.exceptions import ValidationError
|
||||
from django.core.files import File
|
||||
from django.core.files.base import ContentFile
|
||||
from django.db import models, transaction
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
@@ -66,7 +66,7 @@ class Source(models.Model):
|
||||
|
||||
@classmethod
|
||||
def class_fullname(cls):
|
||||
return unicode(dict(SOURCE_CHOICES).get(cls.source_type))
|
||||
return force_text(dict(SOURCE_CHOICES).get(cls.source_type))
|
||||
|
||||
def __str__(self):
|
||||
return '%s' % self.label
|
||||
@@ -133,7 +133,7 @@ class Source(models.Model):
|
||||
try:
|
||||
compressed_file = CompressedFile(file_object)
|
||||
for compressed_file_child in compressed_file.children():
|
||||
kwargs.update({'label': unicode(compressed_file_child)})
|
||||
kwargs.update({'label': force_text(compressed_file_child)})
|
||||
self.upload_document(
|
||||
file_object=File(compressed_file_child), **kwargs
|
||||
)
|
||||
@@ -315,9 +315,9 @@ class StagingFolderSource(InteractiveSource):
|
||||
|
||||
def get_preview_size(self):
|
||||
dimensions = []
|
||||
dimensions.append(unicode(self.preview_width))
|
||||
dimensions.append(force_text(self.preview_width))
|
||||
if self.preview_height:
|
||||
dimensions.append(unicode(self.preview_height))
|
||||
dimensions.append(force_text(self.preview_height))
|
||||
|
||||
return DIMENSION_SEPARATOR.join(dimensions)
|
||||
|
||||
@@ -556,7 +556,7 @@ class EmailBaseModel(IntervalBaseModel):
|
||||
|
||||
headers = decode_header(header_text)
|
||||
header_sections = [
|
||||
unicode(text, charset or default) for text, charset in headers
|
||||
force_text(text, charset or default) for text, charset in headers
|
||||
]
|
||||
return ''.join(header_sections)
|
||||
|
||||
@@ -740,7 +740,7 @@ class WatchFolderSource(IntervalBaseModel):
|
||||
def check_source(self):
|
||||
# Force self.folder_path to unicode to avoid os.listdir returning
|
||||
# str for non-latin filenames, gh-issue #163
|
||||
for file_name in os.listdir(unicode(self.folder_path)):
|
||||
for file_name in os.listdir(force_text(self.folder_path)):
|
||||
full_path = os.path.join(self.folder_path, file_name)
|
||||
if os.path.isfile(full_path):
|
||||
with File(file=open(full_path, mode='rb')) as file_object:
|
||||
|
||||
@@ -4,6 +4,7 @@ from django.apps import apps
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.core.files import File
|
||||
from django.db import OperationalError
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.celery import app
|
||||
@@ -128,8 +129,10 @@ def task_source_handle_upload(self, document_type_id, shared_uploaded_file_id, s
|
||||
for compressed_file_child in compressed_file.children():
|
||||
# TODO: find way to uniquely identify child files
|
||||
# Use filename in the mean time.
|
||||
if unicode(compressed_file_child) not in skip_list:
|
||||
kwargs.update({'label': unicode(compressed_file_child)})
|
||||
if force_text(compressed_file_child) not in skip_list:
|
||||
kwargs.update(
|
||||
{'label': force_text(compressed_file_child)}
|
||||
)
|
||||
|
||||
try:
|
||||
child_shared_uploaded_file = SharedUploadedFile.objects.create(
|
||||
@@ -153,7 +156,7 @@ def task_source_handle_upload(self, document_type_id, shared_uploaded_file_id, s
|
||||
)
|
||||
return
|
||||
else:
|
||||
skip_list.append(unicode(compressed_file_child))
|
||||
skip_list.append(force_text(compressed_file_child))
|
||||
task_upload_document.delay(
|
||||
shared_uploaded_file_id=child_shared_uploaded_file.pk,
|
||||
**kwargs
|
||||
|
||||
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
||||
from django.contrib import messages
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
@@ -118,7 +119,7 @@ class DocumentCreateWizard(ViewPermissionCheckMixin, SessionWizardView):
|
||||
pass
|
||||
|
||||
try:
|
||||
query_dict['tags'] = ([unicode(tag.pk) for tag in self.get_cleaned_data_for_step(STEP_TAGS)['tags']])
|
||||
query_dict['tags'] = ([force_text(tag.pk) for tag in self.get_cleaned_data_for_step(STEP_TAGS)['tags']])
|
||||
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
@@ -3,12 +3,14 @@ from __future__ import unicode_literals
|
||||
import json
|
||||
|
||||
from django.apps import apps
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
|
||||
from celery.schedules import crontab
|
||||
|
||||
from mayan.celery import app
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class StatisticNamespace(object):
|
||||
_registry = {}
|
||||
|
||||
@@ -26,8 +28,8 @@ class StatisticNamespace(object):
|
||||
self._statistics = []
|
||||
self.__class__._registry[slug] = self
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.label)
|
||||
def __str__(self):
|
||||
return force_text(self.label)
|
||||
|
||||
def add_statistic(self, *args, **kwargs):
|
||||
statistic = Statistic(*args, **kwargs)
|
||||
@@ -39,6 +41,7 @@ class StatisticNamespace(object):
|
||||
return self._statistics
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Statistic(object):
|
||||
_registry = {}
|
||||
|
||||
@@ -108,8 +111,8 @@ class Statistic(object):
|
||||
|
||||
self.__class__._registry[slug] = self
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.label)
|
||||
def __str__(self):
|
||||
return force_text(self.label)
|
||||
|
||||
def execute(self):
|
||||
self.store_results(results=self.func())
|
||||
|
||||
Reference in New Issue
Block a user