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
>
>

Reply via email to