only import if layername is valid

This commit is contained in:
j 2012-03-18 14:06:02 +01:00
parent 9413bc4a7a
commit a467d6b0af

View file

@ -542,6 +542,10 @@ class Client(object):
item = args[0] item = args[0]
layer = args[1] layer = args[1]
filename = args[2] filename = args[2]
layers = [l['id'] for l in self.api.site['layers']]
if layer not in layers:
print "invalid layer name, choices are: ", ', '.join(layers)
sys.exit(1)
for s in ox.srt.load(filename): for s in ox.srt.load(filename):
self.api.addAnnotation({ self.api.addAnnotation({
'item;': item, 'item;': item,