Added check for color.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Thu, 15 Aug 2013 11:20:28 +0000 (11:20 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Thu, 15 Aug 2013 11:20:28 +0000 (11:20 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@1518 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrpylib/wrmwmarkup.py

index c968b20d4005453f620b2d32bd33599c74117db4..142512ebaff6695823cb9bc211686dcad15f7394 100644 (file)
@@ -450,7 +450,8 @@ def parse_wrmap(wikitext):
             if len(wrong_properties) > 0:
                 raise RuntimeError("The attribute '{}' is not allowed at <{}>.".format(list(wrong_properties)[0], feature.tag))
             if feature.attrib.has_key('farbe'): 
             if len(wrong_properties) > 0:
                 raise RuntimeError("The attribute '{}' is not allowed at <{}>.".format(list(wrong_properties)[0], feature.tag))
             if feature.attrib.has_key('farbe'): 
-                # TODO: check value
+                if not re.match('#[0-9a-fA-F]{6}$', feature.attrib['farbe']):
+                    raise RuntimeError('The attribute "farbe" has to have a format like "#a0bb43".')
                 properties['strokeColor'] = feature.attrib['farbe'] # e.g. #a200b7
             if feature.attrib.has_key('dicke'):
                 try:
                 properties['strokeColor'] = feature.attrib['farbe'] # e.g. #a200b7
             if feature.attrib.has_key('dicke'):
                 try: