예제 #1
0
 def __init__(self, request):
     self.request = request
     self.cbName = request.params.get("cb")
     self.format = request.params.get("f")
     self.lang = locale_negotiator(request)
     self.translate = request.translate
     self.no_geom = True
     self.addressfields = None
     origin_to_addressfields = {
         "zipcode": "postalcodes",
         "sn25": "swissnames",
         "gg25": "cities",
         "kantone": "cantons",
         "district": "districts",
         "address": "address",
         "parcel": "parcel",
     }
     self.afs = {}
     for af in AVAILABLE_ADDRESSFIELDS:
         self.afs[af] = request.params.get(af, None)
     self.origins = []
     self.origins = list(
         origin
         for origin, af in origin_to_addressfields.iteritems()
         if self.afs[af] != None or self.afs["all"] != None or self.afs["egid"] != None
     )
예제 #2
0
 def __init__(self, request):
     super(MapService, self).__init__()
     self.request = request
     self.mapName = request.matchdict.get('map') # The topic
     self.cbName = request.params.get('cb')
     self.lang = locale_negotiator(request)
     self.searchText = request.params.get('searchText')
     self.translate = request.translate
예제 #3
0
 def __init__(self, request):
     super(MapService, self).__init__()
     self.request = request
     self.mapName = request.matchdict.get('map')  # The topic
     self.cbName = request.params.get('cb')
     self.lang = locale_negotiator(request)
     self.searchText = request.params.get('searchText')
     self.geodataStaging = request.registry.settings['geodata_staging']
     self.translate = request.translate
예제 #4
0
def add_localizer(event):
    request = event.request
    request._LOCALE_ = helpers.locale_negotiator(request)
    localizer = get_localizer(request)
    request.lang = localizer.locale_name

    def auto_translate(string):
        return localizer.translate(tsf(string))

    request.localizer = localizer
    request.translate = auto_translate
예제 #5
0
 def __init__(self, request):
     self.request = request
     self.cbName = request.params.get('cb')
     self.format = request.params.get('f')
     self.lang = locale_negotiator(request)
     self.translate = request.translate
     self.no_geom = True
     self.addressfields = None
     origin_to_addressfields = {'zipcode': 'postalcodes', 'sn25': 'swissnames', 'gg25': 'cities', 'kantone': 'cantons', 'district': 'districts', 'address': 'address', 'parcel': 'parcel'}
     self.afs = {}
     for af in AVAILABLE_ADDRESSFIELDS:
         self.afs[af] = request.params.get(af, None)
     self.origins = []
     self.origins = list(origin for origin, af in origin_to_addressfields.iteritems() if self.afs[af] != None or self.afs['all'] != None or self.afs['egid'] != None)
예제 #6
0
 def __init__(self, request):
     super(WMTSCapabilites, self).__init__()
     self.mapName = request.matchdict.get('map')
     self.lang = locale_negotiator(request)
     self.models = get_wmts_models(self.lang)
     self.request = request