Changeset ada47d9 in osmose-backend


Ignore:
Timestamp:
Oct 13, 2014 5:44:40 PM (5 years ago)
Author:
Frédéric Rodrigo <fred.rodrigo@…>
Branches:
master
Children:
7149ed9
Parents:
4cf7d2f
git-author:
Frédéric Rodrigo <fred.rodrigo@…> (12/10/2014 21:20:24)
git-committer:
Frédéric Rodrigo <fred.rodrigo@…> (13/10/2014 17:44:40)
Message:

Check addr:interpolation value in TagFix_Housenumber

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/TagFix_Housenumber.py

    r4cf7d2f rada47d9  
    2929        self.errors[10] = { "item": 2060, "level": 3, "tag": ["addr", "fix:survey"], "desc": T_(u"addr:housenumber does not start by a number") } 
    3030        self.errors[11] = { "item": 2060, "level": 3, "tag": ["addr", "fix:chair"], "desc": T_(u"On interpolation addr:* go to object with addr:housenumber") } 
     31        self.errors[12] = { "item": 2060, "level": 3, "tag": ["addr", "fix:chair"], "desc": T_(u"Invalid addr:interpolation value") } 
    3132 
    3233    def node(self, data, tags): 
     
    3940    def way(self, data, tags, nds): 
    4041        err = self.node(data, tags) 
    41         if tags.get("addr:interpolation"): 
     42        interpolation = tags.get("addr:interpolation") 
     43        if interpolation: 
    4244            if len(filter(lambda x: x.startswith("addr:") and x != "addr:interpolation", tags.keys())) > 0: 
    4345                err.append((11, 1, {})) 
     46            if interpolation not in ('even', 'odd', 'all', 'alphabetic') and not interpolation.isdigit(): 
     47                err.append((12, 1, {})) 
    4448 
    4549        return err 
     
    6367        assert a.node(None, {"addr:housenumber": "?"}) 
    6468 
     69 
    6570        assert a.way(None, {"addr:stret": "Lomlim", "addr:interpolation": "even"}, None) 
     71        assert not a.way(None, {"addr:interpolation": "even"}, None) 
     72        assert not a.way(None, {"addr:interpolation": "4"}, None) 
     73        assert a.way(None, {"addr:interpolation": "invalid"}, None) 
Note: See TracChangeset for help on using the changeset viewer.