def read(self, request, jdbc_source_slug, filter_id, parameter_id, location_id): filter_id = urllib.unquote(filter_id) parameter_id = urllib.unquote(parameter_id) location_id = urllib.unquote(location_id) layer_arguments = { 'slug': jdbc_source_slug, 'filter': filter_id, 'parameter': parameter_id, } adapter = FewsJdbc(None, layer_arguments=layer_arguments) identifiers = [{'location': location_id}] start_date, end_date = start_end_dates(request) height = request.GET.get('height', 500) width = request.GET.get('width', 500) try: result = adapter.image(identifiers, start_date, end_date, height=height, width=width, raise_404_if_empty=True) return result except Http404: response = rc.NOT_FOUND response.write( "No data found for this filter/parameter/location combination") return response
def test_location_parameter_name(self): # A parameter with a unicode character used to crash our # parameter+locationname code. adapter = FewsJdbc() adapter._parameter_name = u'Debiet m\xb3/s' self.assertTrue(adapter._location_plus_parameter('location name'))