Changeset 00969ce in osmose-backend


Ignore:
Timestamp:
Dec 4, 2014 9:01:07 PM (5 years ago)
Author:
Frédéric Rodrigo <fred.rodrigo@…>
Branches:
master
Children:
6ad2831
Parents:
9d24b65
git-author:
Frédéric Rodrigo <fred.rodrigo@…> (04/12/2014 20:47:58)
git-committer:
Frédéric Rodrigo <fred.rodrigo@…> (04/12/2014 21:01:07)
Message:

Support CZ address housenumber like ev.387

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/TagFix_Housenumber.py

    rb403591 r00969ce  
    3030        self.errors[14] = { "item": 2060, "level": 3, "tag": ["addr", "fix:chair"], "desc": T_(u"On interpolation addr:* go to object with addr:housenumber") } 
    3131        self.errors[15] = { "item": 2060, "level": 3, "tag": ["addr", "fix:chair"], "desc": T_(u"Invalid addr:interpolation value") } 
     32        self.CountryCZ = self.father.config.options.get("country") == "CZ" 
    3233 
    3334    def node(self, data, tags): 
    3435        err = [] 
    35         if "addr:housenumber" in tags and (len(tags["addr:housenumber"]) == 0 or not tags["addr:housenumber"][0].isdigit()): 
     36        if "addr:housenumber" in tags and (len(tags["addr:housenumber"]) == 0 or not ( 
     37            tags["addr:housenumber"][0].isdigit() or 
     38            (self.CountryCZ and tags["addr:housenumber"].startswith('ev.') and tags["addr:housenumber"][3].isdigit()) 
     39            )): 
    3640            err.append((10, 1, {})) 
    3741 
     
    5963    def test(self): 
    6064        a = TagFix_Housenumber(None) 
     65        class _config: 
     66            options = {"country": "CZ"} 
     67        class father: 
     68            config = _config() 
     69        a.father = father() 
    6170        a.init(None) 
    6271 
     
    6978        assert a.relation(None, {"addr:housenumber": "?"}, None) 
    7079 
    71  
    7280        assert a.way(None, {"addr:stret": "Lomlim", "addr:interpolation": "even"}, None) 
    7381        assert not a.way(None, {"addr:interpolation": "even"}, None) 
    7482        assert not a.way(None, {"addr:interpolation": "4"}, None) 
    7583        assert a.way(None, {"addr:interpolation": "invalid"}, None) 
     84 
     85        assert not a.way(None, {"addr:housenumber": "ev.387"}, None) # In CZ 
Note: See TracChangeset for help on using the changeset viewer.