src/p4l/utils.py
changeset 113 c05567404888
parent 109 9328fa268f45
child 114 93b45b4f423c
--- a/src/p4l/utils.py	Fri Sep 20 15:44:11 2013 +0200
+++ b/src/p4l/utils.py	Fri Sep 20 22:21:48 2013 +0200
@@ -1,14 +1,13 @@
 # -*- coding: utf-8 -*-
-import codecs #@UnresolvedImport
+import codecs
 import logging
 import math
 import sys
+import unicodedata
 
 from django.conf import settings
-from django.db.models.query import QuerySet
-from django.db.models.query_utils import Q
-import requests #@UnresolvedImport
 from django.core.validators import URLValidator
+import requests
 
 
 logger = logging.getLogger(__name__)
@@ -181,4 +180,8 @@
                     found += 1
                     writer = show_progress(i, total_objs, l, 50, writer=writer)
     print("Processing Sparql Done. %d found on %d" % (found, total_objs))
+
+def strip_accents(value):
+    return ''.join(c for c in unicodedata.normalize('NFD', value)
+                  if unicodedata.category(c) != 'Mn')
     
\ No newline at end of file