summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-03-07 17:53:24 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-03-07 18:16:51 +0100
commit6c8a5d46fcdc574c1c8b0fbafa8e6b88e5436859 (patch)
treeadf88fdce51d932ba3533995f3da29403250485b
parent56b8c7a2705a0bf1434b5f917e3ba375646c6b35 (diff)
downloadIshtar-6c8a5d46fcdc574c1c8b0fbafa8e6b88e5436859.tar.bz2
Ishtar-6c8a5d46fcdc574c1c8b0fbafa8e6b88e5436859.zip
Operations import: filter name
-rw-r--r--archaeological_operations/import_from_dbf.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/archaeological_operations/import_from_dbf.py b/archaeological_operations/import_from_dbf.py
index 5c3d942d7..b539d3a51 100644
--- a/archaeological_operations/import_from_dbf.py
+++ b/archaeological_operations/import_from_dbf.py
@@ -25,6 +25,7 @@ from __future__ import unicode_literals
import datetime
import dbf
+import re
from django.contrib.auth.models import User
from django.db import transaction
@@ -102,9 +103,20 @@ def parse_patriarche_operationtype(value):
return None
return _CACHED_OPE_TYPES[value]
+_dpt_re_filter = re.compile('^\([0-9]*\) ')
+
+def parse_ope_name(value):
+ if not value:
+ return ''
+ value = value.strip()
+ if value.lower() == 'null':
+ return ''
+ value = _dpt_re_filter.sub('', value)
+ return value
+
PATRIARCHE_DBF_OPE_COLS = [
(('operation_type',), 'parse_patriarche_operationtype', []),
- (('common_name',), unicode, []),
+ (('common_name',), 'parse_ope_name', []),
[],
(('in_charge',), 'parse_person', [2]),
[], #'etat',