Hy guys, thanks for your suggestions. I made some trials here https://github.com/simod/geonode/commit/4a999eb428196d492247038b1a0772bdd1b531d0
I wrote two tests, one to check if the MapLayer.local method returns True when the layer is served by the local Geoserver and the other to test the MapLayer.local_link. However to match the actual geonode configuration that sets the MapLayer.ows_url to '/geoserver/wms' I had to modify the initial data for the tests setting the ows_url to this value for the local layer. This should be IP independent. This approach doesn't consider the possible solution of modifying the way the Map saves the MapLayer.ows_url, which maybe could also be taken into consideration. I'm not sure if this could be a basis for solving the problem but maybe can help to focus on where it is located. Thanks a lot for your suggestions. Simone. 2011/11/22 David Winslow <[email protected]> > I think Jeff Johnson's recent work on source tracking in GeoNode might be > relevant to this, although that work is probably not suitable for the > master branch at the moment. Jeff, care to weigh in? > > -- > David Winslow > OpenGeo - http://opengeo.org/ > > > On Mon, Nov 21, 2011 at 10:55 AM, Ariel Nunez <[email protected]>wrote: > >> Hey Simone, >> >> The same problem seems to be happening in the map detail view where local >> layers don't get linked correctly. It is specially harder after the IP >> address has changed. >> >> We need to approach this problem from a more general point of view but I >> don't feel too confident about these heuristics if we don't have associated >> tests. How would you feel about writing some with the relevant scenarios? >> >> Thanks for tackling this! >> >> Ariel >> >> >> On Thu, Nov 17, 2011 at 6:14 AM, Simone Dalmasso < >> [email protected]> wrote: >> >>> Hi list, >>> >>> I was checking the state of the ticket #937 opened by me some months ago. >>> I discovered that the issue I've reported is not present anymore however >>> the map/x/download is still not working. >>> >>> After some bug hunting the problem seem to be that while creating a >>> MapLayer the ows_url is set to DEFAULT_LAYER_SOURCE['url'] from the >>> settings module but the MapLayer.local method compares the ows_url to the >>> settings.GEOSERVER_BASE_URL address which is usually different. The result >>> is that no MapLayer is considered as local and then the download fails. >>> >>> A possible solution that I tried is to use the geoserver.catalog to >>> check if the layer is actually served by the local geoserver. >>> >>> Here some raw code: >>> >>> def local(self): >>> """ >>> Tests whether this layer is served by the GeoServer instance >>> that is >>> paired with the GeoNode site. Currently this is based on >>> heuristics, >>> but we try to err on the side of false negatives. >>> """ >>> from geoserver.layer import Layer as GsLayer >>> url = url = "%srest" % settings.GEOSERVER_BASE_URL >>> c = Catalog(url, _user, _password) >>> if isinstance(c.get_layer(self.name),GsLayer): >>> #if self.ows_url == (settings.GEOSERVER_BASE_URL + "wms"): >>> return Layer.objects.filter(typename=self.name).count() != 0 >>> else: >>> return False >>> >>> There can be many other solutions, but I'd like to have your point of >>> view. >>> >>> Thanks! >>> >>> -- >>> Simone >>> >>> >> > -- Simone Dalmasso, Ph.D. Geomatics Environmental Engineer ITHACA Information Technology for Humanitarian Assistance, Cooperation and Action www.ithacaweb.org Via Pier Carlo Boggio 61 - 10138 Torino Tel: +39.011.1975.1860
