diff options
| 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 | 
| commit | 8666b398cd9ec7affb2dbcf9dc08f17434133c61 (patch) | |
| tree | adf88fdce51d932ba3533995f3da29403250485b | |
| parent | 0c2e5b7154f0f82e47155d81fb483309fb81ec4f (diff) | |
| download | Ishtar-8666b398cd9ec7affb2dbcf9dc08f17434133c61.tar.bz2 Ishtar-8666b398cd9ec7affb2dbcf9dc08f17434133c61.zip | |
Operations import: filter name
| -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', | 
