DescriptionList: support functionchar while loading ids/rics

This commit is contained in:
Jan Bollacke 2017-04-28 07:44:12 +02:00
parent 58b3158e9a
commit 5ccd6d8cc0
No known key found for this signature in database
GPG key ID: 962547ACB939C2E9

View file

@ -11,6 +11,7 @@ Function to expand the dataset with a description.
import logging # Global logger
import csv # for loading the description files
import re # for matching IDs with a regular expression
from includes import globalVars # Global variables
from includes.helper import stringConverter
@ -41,8 +42,8 @@ def loadCSV(typ, idField):
reader = csv.DictReader(csvfile)
for row in reader:
logging.debug(row)
# only import rows with an integer as id
if row[idField].isdigit() == True:
# only import rows with an integer as id, allow subrics though
if re.match("^[0-9]+[A-D]?$", idField, re.IGNORECASE):
try:
resultList[row[idField]] = stringConverter.convertToUTF8(row['description'])
except: