Remove errors due to too much spaces in fields

Start type at a save value of 100


svn: r22436
This commit is contained in:
Benny Malengier 2013-05-27 19:45:30 +00:00
parent e50182508a
commit 77ceea2931
2 changed files with 597 additions and 597 deletions

View File

@ -63,7 +63,7 @@ ident = ''
TYPE2CITEMAP = {} TYPE2CITEMAP = {}
FIELDTYPEMAP = {} FIELDTYPEMAP = {}
index = 10 index = 100
indexval = 10 indexval = 10
first = True first = True
@ -76,11 +76,11 @@ with open(csvfilename, 'rb') as csvfile:
continue continue
if row[CATCOL]: if row[CATCOL]:
cat = row[CATCOL] cat = row[CATCOL].strip()
cattype = row[CATTYPECOL] cattype = row[CATTYPECOL].strip()
type = row[TYPECOL] type = row[TYPECOL].strip()
descr = row[DESCRCOL] descr = row[DESCRCOL].strip()
source_type = row[IDENTCOL] source_type = row[IDENTCOL].strip()
if descr: if descr:
source_descr = '%s - %s - %s (%s)' % (type, cattype, cat, descr) source_descr = '%s - %s - %s (%s)' % (type, cattype, cat, descr)
source_descr_code = "_('%(first)s - %(sec)s - %(third)s (%(fourth)s)') % { "\ source_descr_code = "_('%(first)s - %(sec)s - %(third)s (%(fourth)s)') % { "\
@ -105,9 +105,9 @@ with open(csvfilename, 'rb') as csvfile:
if row[CITETYPECOL]: if row[CITETYPECOL]:
#new citation type, #new citation type,
cite_type = row[CITETYPECOL] cite_type = row[CITETYPECOL].strip()
#add field for template to evidence style #add field for template to evidence style
field = row[FIELDCOL] field = row[FIELDCOL].strip()
field_type = field.replace(' ', '_').replace("'","")\ field_type = field.replace(' ', '_').replace("'","")\
.replace('&','AND').replace('(', '6').replace(')','9')\ .replace('&','AND').replace('(', '6').replace(')','9')\
.replace('[', '').replace(']','').replace('/', '_OR_')\ .replace('[', '').replace(']','').replace('/', '_OR_')\
@ -121,16 +121,17 @@ with open(csvfilename, 'rb') as csvfile:
index += 1 index += 1
fielddata = [] fielddata = []
private = 'False' private = 'False'
if row[PRIVACYCOL]: if row[PRIVACYCOL].strip():
private = 'True' private = 'True'
optional = 'False' optional = 'False'
if row[OPTCOL]: if row[OPTCOL].strip():
optional = 'True' optional = 'True'
TYPE2CITEMAP[source_type][cite_type] += [(row[LDELCOL], field_type, TYPE2CITEMAP[source_type][cite_type] += [(row[LDELCOL], field_type,
row[RDELCOL], row[STYLECOL], private, optional)] row[RDELCOL], row[STYLECOL], private, optional)]
#now generate the python code we need in source attr types #now generate the python code we need in source attr types
code = "" code = " #following fields are generated with evidencefieldgenerator.py\n" \
" #the index starts at 100!\n"
datamap = "\n _DATAMAP += [\n" datamap = "\n _DATAMAP += [\n"
allkeys = sorted(FIELDTYPEMAP.keys()) allkeys = sorted(FIELDTYPEMAP.keys())
for field_type in allkeys: for field_type in allkeys:

File diff suppressed because it is too large Load Diff