diff options
| -rw-r--r-- | archaeological_operations/import_from_dbf.py | 14 | 
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', | 
