reduce entries in globals.py

only entries for use in more than one .py-file have to stay here...
This commit is contained in:
JHCD 2015-07-31 19:50:27 +02:00
parent e26fc45313
commit 02efb9552a
4 changed files with 45 additions and 37 deletions

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# -*- coding: utf-8 -*-
"""
Function to expand the dataset with a description.
@ -10,13 +10,18 @@ Function to expand the dataset with a description.
"""
import logging # Global logger
import csv # for loading the description files
from includes import globals # Global variables
from includes.helper import stringConverter
# local variables
fmsDescribtionList = {}
zveiDescribtionList = {}
ricDescribtionList = {}
##
#
# Local function will load the csv-file
@ -67,15 +72,18 @@ def loadDescriptionLists():
if globals.config.getint("FMS", "idDescribed"):
logging.debug("- load FMS description list")
globals.fmsDescribtionList = loadCSV("fms", "fms")
global fmsDescribtionList
fmsDescribtionList = loadCSV("fms", "fms")
if globals.config.getint("ZVEI", "idDescribed"):
logging.debug("- load ZVEI description list")
globals.zveiDescribtionList = loadCSV("zvei", "zvei")
global zveiDescribtionList
zveiDescribtionList = loadCSV("zvei", "zvei")
if globals.config.getint("POC", "idDescribed"):
logging.debug("- load pocsag description list")
globals.ricDescribtionList = loadCSV("poc", "ric")
global ricDescribtionList
ricDescribtionList = loadCSV("poc", "ric")
except:
logging.error("cannot load description lists")
@ -98,11 +106,14 @@ def getDescription(typ, id):
logging.debug("look up description lists")
try:
if typ == "FMS":
resultStr = globals.fmsDescribtionList[id]
global fmsDescribtionList
resultStr = fmsDescribtionList[id]
elif typ == "ZVEI":
resultStr = globals.zveiDescribtionList[id]
global zveiDescribtionList
resultStr = zveiDescribtionList[id]
elif typ == "POC":
resultStr = globals.ricDescribtionList[id]
global ricDescribtionList
resultStr = ricDescribtionList[id]
else:
logging.warning("Invalid Typ: %s", typ)