diff options
Diffstat (limited to 'ishtar_common/utils.py')
| -rw-r--r-- | ishtar_common/utils.py | 28 | 
1 files changed, 14 insertions, 14 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 4f48cb08b..33d1f5bec 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -250,7 +250,7 @@ class MultiValueDict(BaseMultiValueDict):              v = v()          if type(v) in (list, tuple) and len(v) > 1:              v = ",".join(v) -        elif type(v) not in (int, unicode): +        elif type(v) not in (int, str):              v = super(MultiValueDict, self).get(*args, **kwargs)          return v @@ -289,11 +289,11 @@ def get_cache(cls, extra_args=tuple(), app_label=None):              cache_key += '-0'          else:              if type(arg) == dict: -                cache_key += '-' + "_".join([unicode(arg[k]) for k in arg]) +                cache_key += '-' + "_".join([str(arg[k]) for k in arg])              elif type(arg) in (list, tuple): -                cache_key += '-' + "_".join([unicode(v) for v in arg]) +                cache_key += '-' + "_".join([str(v) for v in arg])              else: -                cache_key += '-' + unicode(arg) +                cache_key += '-' + str(arg)      cache_key = slugify(cache_key)      if not cache_key.endswith('_current_keys') \              and hasattr(cls, '_add_cache_key_to_refresh'): @@ -413,10 +413,10 @@ def _get_image_link(doc):          # image attached to nothing...          return "" -    item_class_name = unicode(item.__class__._meta.verbose_name) +    item_class_name = str(item.__class__._meta.verbose_name)      if item.__class__.__name__ == "ArchaeologicalSite": -        item_class_name = unicode(IshtarSiteProfile.get_default_site_label()) +        item_class_name = str(IshtarSiteProfile.get_default_site_label())      return mark_safe(u"""      <div class="col col-lg-3"> @@ -444,10 +444,10 @@ def _get_image_link(doc):          doc.image.url,          doc.thumbnail.url,          item_class_name, -        unicode(item), +        str(item),          reverse(item.SHOW_URL, args=[item.pk, '']), -        unicode(_(u"Information")), -        unicode(_(u"Load another random image?")))) +        str(_(u"Information")), +        str(_(u"Load another random image?"))))  def get_random_item_image_link(request): @@ -520,7 +520,7 @@ def post_save_geo(sender, **kwargs):      current_source = "default"      if hasattr(instance.__class__, "_meta"): -        current_source = unicode(instance.__class__._meta.verbose_name) +        current_source = str(instance.__class__._meta.verbose_name)      modified = False      if hasattr(instance, 'multi_polygon'): @@ -772,7 +772,7 @@ def put_session_message(session_key, message, message_type):      messages = []      if 'messages' in session:          messages = session['messages'][:] -    messages.append((unicode(message), message_type)) +    messages.append((str(message), message_type))      session['messages'] = messages      session.save() @@ -1147,7 +1147,7 @@ def m2m_historization_changed(sender, **kwargs):  def max_size_help(): -    msg = unicode(_(u"The maximum supported file size is {} Mo.")).format( +    msg = str(_(u"The maximum supported file size is {} Mo.")).format(          settings.MAX_UPLOAD_SIZE      )      return msg @@ -1268,9 +1268,9 @@ def get_used_media(exclude=None, limit=None,      else:          media = set()      for field in get_file_fields(): -        if exclude and unicode(field) in exclude: +        if exclude and str(field) in exclude:              continue -        if limit and unicode(field) not in limit: +        if limit and str(field) not in limit:              continue          is_null = {'%s__isnull' % field.name: True}          is_empty = {'%s' % field.name: ''}  | 
