Skip to content

Commit

Permalink
Avoid duplicate error id from TagFix_BadKey osm-fr#560
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed Jul 15, 2019
1 parent 2f9182d commit de271c1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugins/TagFix_BadKey.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
## ##
###########################################################################

from modules.Stablehash import stablehash
from plugins.Plugin import Plugin

class TagFix_BadKey(Plugin):

def init(self, logger):
Plugin.init(self, logger)
self.errors[3050] = { "item": 3050, "level": 1, "tag": ["tag", "fix:chair"], "desc": T_(u"Bad tag") }
self.errors[3050] = { "item": 3050, "level": 1, "tag": ["tag", "fix:chair"], "desc": T_(u"Bad tag") }
self.errors[30501] = { "item": 3050, "level": 1, "tag": ["tag", "fix:chair"], "desc": T_(u"Bad tag suffix") }

import re
self.KeyPart1 = re.compile("^[a-zA-Z_0-9]+$")
Expand Down Expand Up @@ -61,9 +63,9 @@ def node(self, data, tags):
continue

if not self.KeyPart1.match(part[0]):
err.append({"class": 3050, "subclass": 0, "text": T_("Bad tag %(k)s=%(v)s", {"k":k, "v":tags[k]})})
err.append({"class": 3050, "subclass": stablehash(k), "text": T_("Bad tag %(k)s=%(v)s", {"k":k, "v":tags[k]})})
elif len(part) == 2 and not self.KeyPart2.match(part[1]):
err.append({"class": 3050, "subclass": 1, "text": T_("Bad tag %(k)s=%(v)s", {"k":k, "v":tags[k]})})
err.append({"class": 30501, "subclass": stablehash(k), "text": T_("Bad tag suffix %(k)s=%(v)s", {"k":k, "v":tags[k]})})

return err

Expand Down

0 comments on commit de271c1

Please sign in to comment.