Changeset 9556384 in osmose-backend


Ignore:
Timestamp:
Oct 4, 2014 4:22:13 PM (5 years ago)
Author:
Frédéric Rodrigo <fred.rodrigo@…>
Branches:
master
Children:
6a27639
Parents:
4f0c747
git-author:
Frédéric Rodrigo <fred.rodrigo@…> (04/10/2014 15:19:27)
git-committer:
Frédéric Rodrigo <fred.rodrigo@…> (04/10/2014 16:22:13)
Message:

Split Source plugin into genereic and specific for France

Location:
plugins
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/Source.py

    ra076c4c r9556384  
    44##                                                                       ## 
    55## Copyrights Etienne Chové <chove@crans.org> 2010                       ## 
     6## Copyrights Frédéric Rodrigo 2011-2014                                 ## 
    67##                                                                       ## 
    78## This program is free software: you can redistribute it and/or modify  ## 
     
    2627class Source(Plugin): 
    2728 
    28     only_for = ["FR"] 
    29  
    3029    def init(self, logger): 
    3130        Plugin.init(self, logger) 
    3231        self.errors[706] = { "item": 3020, "level": 1, "tag": ["source", "fix:chair"], "desc": T_(u"Illegal or incomplete source tag") } 
    3332        self.errors[707] = { "item": 2040, "level": 3, "tag": ["source", "fix:chair"], "desc": T_(u"Missing source tag") } 
    34         self.IGN = re.compile(".*(\wign)|(ign\w).*") 
    3533 
    3634    def check(self, tags): 
    37         if u"AAAA" in tags[u"source"]: 
    38             return [(706,0,{"fr":u"Le tag source contient AAAA", "en":u"Source tag contains AAAA"})] 
    39         if u"Cartographes Associés" in tags[u"source"]: 
    40             return [(706,1,{"en":u"Cartographes Associés"})] 
    4135        source = tags[u"source"].lower() 
    4236        if u"google" in source: 
    4337            return [(706,2,{"en":u"Google"})] 
    44         if u"geoportail" in source or u"géoportail" in source: 
    45             return [(706,3,{"en":u"Géoportail"})] 
    46         if u"ign" in source and not u"geofla" in source and not u"cartographie réglementaire" in source and not u"géodési" in source and not u"500" in source: 
    47             if not self.IGN.match(source): 
    48                 return [(706,4,{"en":u"IGN"})] 
    49         if u"camptocamp" in source: 
    50             return [(706,5,{"en":u"CampToCamp"})] 
    5138 
    5239    def node(self, data, tags): 
     
    7562        a = Source(None) 
    7663        a.init(None) 
    77         for d in [{u"source":u"nign"}, 
    78                   {u"source":u"ignoville"}, 
    79                   {u"source":u"IGN géodésique"}, 
    80                   {u"source":u"road sign"}, 
     64        for d in [{u"source":u"Free"}, 
    8165                 ]: 
    8266            assert not a.node(None, d), d 
    8367 
    84         for d in [{u"source":u"IGN"}]: 
     68        for d in [{u"source":u"google maps"}]: 
    8569             self.check_err(a.node(None, d), d) 
Note: See TracChangeset for help on using the changeset viewer.