From 27c6ee68fb90f47bf7a5a94c6f0eefa09b6e53b9 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 4 Feb 2021 18:54:48 +0100 Subject: Typo fix --- ishtar_common/utils.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'ishtar_common/utils.py') diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index d86c94d86..aad995198 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -140,12 +140,12 @@ def import_class(full_path_classname): elif 'models' not in mods and 'models_finds' not in mods \ and 'models_treatments' not in mods: raise SuspiciousOperation( - u"Try to import a non model from a string") + "Try to import a non model from a string") module = import_module('.'.join(mods[:-1])) model = getattr(module, mods[-1]) if not issubclass(model, models.Model): raise SuspiciousOperation( - u"Try to import a non model from a string") + "Try to import a non model from a string") return model @@ -172,7 +172,7 @@ def check_rights(rights=None, redirect_url='/'): return view_func(request, *args, **kwargs) put_session_message( request.session.session_key, - _(u"You don't have sufficient permissions to do this action."), + _("You don't have sufficient permissions to do this action."), 'warning' ) return HttpResponseRedirect(redirect_url) @@ -243,7 +243,7 @@ def update_data(data_1, data_2, merge=False): if not merge: return data_1 if data_2 and data_2 != data_1: - return data_1 + u" ; " + data_2 + return data_1 + " ; " + data_2 return data_1 for k in data_1: if k not in data_2: @@ -301,7 +301,7 @@ def clean_empty_data(data): Clean empty branches of a data dict """ for key in data.keys(): - if data[key] in [{}, None, u""]: + if data[key] in [{}, None, ""]: data.pop(key) continue if isinstance(data[key], dict): @@ -348,7 +348,7 @@ def get_current_year(): def get_cache(cls, extra_args=tuple(), app_label=None): if not app_label: app_label = cls._meta.app_label - cache_key = u"{}-{}-{}".format( + cache_key = "{}-{}-{}".format( settings.PROJECT_SLUG, app_label, cls.__name__) for arg in extra_args: if not arg: @@ -607,7 +607,7 @@ def _get_image_link(doc): if item.__class__.__name__ == "ArchaeologicalSite": item_class_name = str(IshtarSiteProfile.get_default_site_label()) - return mark_safe(u""" + return mark_safe("""
@@ -635,8 +635,8 @@ def _get_image_link(doc): item_class_name, str(item), reverse(item.SHOW_URL, args=[item.pk, '']), - str(_(u"Information")), - str(_(u"Load another random image?")))) + str(_("Information")), + str(_("Load another random image?")))) def get_random_item_image_link(request): @@ -682,8 +682,8 @@ def get_srid_obj_from_point(point): return SpatialReferenceSystem.objects.create( srid=int(point.srid), auth_name='EPSG', - label=u"EPSG-{}".format(point.srid), - txt_idx=u"epsg-{}".format(point.srid), + label="EPSG-{}".format(point.srid), + txt_idx="epsg-{}".format(point.srid), ) @@ -1257,7 +1257,7 @@ def generate_relation_graph(obj, highlight_current=True, style = 'label="{}"'.format(obj.relation_label) if highlight_current: style += ',style=filled,fillcolor="#C6C0C0"' - dot_str += u'item{}[{},href="{}"];\n'.format( + dot_str += 'item{}[{},href="{}"];\n'.format( obj.pk, style, reverse('display-item', args=[model.SLUG, obj.pk]) @@ -1276,7 +1276,7 @@ def generate_relation_graph(obj, highlight_current=True, style = 'label="{}"'.format(left.relation_label) if left.pk == obj.pk and highlight_current: style += ',style=filled,fillcolor="#C6C0C0"' - dot_str += u'item{}[{},href="{}"];\n'.format( + dot_str += 'item{}[{},href="{}"];\n'.format( left.pk, style, reverse('display-item', args=[model.SLUG, left.pk]) ) @@ -1286,17 +1286,17 @@ def generate_relation_graph(obj, highlight_current=True, style = 'label="{}"'.format(right.relation_label) if right.pk == obj.pk and highlight_current: style += ',style=filled,fillcolor="#C6C0C0"' - dot_str += u'item{}[{},href="{}"];\n'.format( + dot_str += 'item{}[{},href="{}"];\n'.format( right.pk, style, reverse('display-item', args=[model.SLUG, right.pk]) ) if not directed: # on the same level - rel_str += u"{{rank = same; item{}; item{};}}\n".format( + rel_str += "{{rank = same; item{}; item{};}}\n".format( left_pk, right_pk) style = "" if (left_pk, right_pk) in styles: style = " [{}]".format(", ".join(styles[(left_pk, right_pk)])) - rel_str += u'item{} -> item{}{};\n'.format(left_pk, right_pk, style) + rel_str += 'item{} -> item{}{};\n'.format(left_pk, right_pk, style) rel_str += "}\n" dot_str += rel_str + "\n}" @@ -1361,7 +1361,7 @@ def generate_relation_graph(obj, highlight_current=True, getattr(obj, attr).save("relations.png", django_file, save=True) if debug: - print(u"DOT file: {}. Tmp SVG file: {}.".format(dot_name, svg_tmp_name)) + print("DOT file: {}. Tmp SVG file: {}.".format(dot_name, svg_tmp_name)) return shutil.rmtree(tempdir) @@ -1393,7 +1393,7 @@ def create_default_json_fields(model): JsonDataField.objects.get_or_create( content_type=content_type, key=key, defaults={ - 'name': u" ".join(key.split('__')).capitalize(), + 'name': " ".join(key.split('__')).capitalize(), 'value_type': 'T', 'display': False } @@ -1471,7 +1471,7 @@ def m2m_historization_changed(sender, **kwargs): def max_size_help(): - msg = str(_(u"The maximum supported file size is {} Mo.")).format( + msg = str(_("The maximum supported file size is {} Mo.")).format( settings.MAX_UPLOAD_SIZE ) return msg -- cgit v1.2.3