Commit aeabb51f authored by Miguel Tremblay's avatar Miguel Tremblay
Browse files

Add an error message when the layer type is invalid.

parent 71d2d29e
...@@ -122,13 +122,21 @@ def list_to_coordinate(lValue): ...@@ -122,13 +122,21 @@ def list_to_coordinate(lValue):
return (lat,lon) return (lat,lon)
def roadlayer_type_to_roadlayer_code(sLayerType): def roadlayer_type_to_roadlayer_code(sLayerType):
dValidLayerType = metro_config.get_value('XML_STATION_ROADLAYER_VALID_TYPE') dValidLayerType = metro_config.get_value(\
'XML_STATION_ROADLAYER_VALID_TYPE')
sLayerType = sLayerType.upper() sLayerType = sLayerType.upper()
if sLayerType in dValidLayerType: if sLayerType in dValidLayerType:
iLayer_code = dValidLayerType[sLayerType] iLayer_code = dValidLayerType[sLayerType]
else: else:
sDefaultLayerType = metro_config.get_value('DEFAULT_STATION_ROADLAYER_TYPE') # raise an error
sMessage = _("'%s' is not a valid road layer type. ") % (sLayerType) +\
_("Valid type are %s " ) % (dValidLayerType.keys()) +\
_("Check the station configuration file")
metro_logger.print_message(metro_logger.LOGGER_MSG_STOP, sMessage)
sDefaultLayerType = metro_config.get_value(\
'DEFAULT_STATION_ROADLAYER_TYPE')
sDefaultLayerType = sDefaultLayerType.upper() sDefaultLayerType = sDefaultLayerType.upper()
iLayer_code = dValidLayerType[sDefaultLayerType] iLayer_code = dValidLayerType[sDefaultLayerType]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment