GeoNode / geonode

GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.
https://geonode.org/
Other
1.43k stars 1.12k forks source link

Fix PEP8 violations in the base app. #1577

Closed garnertb closed 10 years ago

garnertb commented 10 years ago

Fix the PEP8 violations in the base app.

How to find PEP8 violations:

  1. Install flake8: pip install flake8 in your GeoNode virtual environment.
  2. cd <geonode_root>/geonode/base
  3. flake8 .
  4. At this point, all PEP8 violations will be printed to stdout. You will need to fix or whitelist every PEP8 violation in the app.

White listing Whitelisting should be used to ignore PEP8 violations that cannot be prevented.

Note: You can add questions specific to this app in this thread. If you have general questions about PEP8 compliance in GeoNode add it to the main thread here: https://github.com/GeoNode/geonode/issues/1576

garnertb commented 10 years ago

@capooti, on this line: https://github.com/GeoNode/geonode/blob/master/geonode/base/models.py#L439, description is an undefined variable and it is not immediately apparent to me what description should be maybe self.description? Any ideas?

capooti commented 10 years ago

Hi @garnertb sorry, it was a refuse. By the way, I see that you don't store anymore the different link_type but always the same value ('WWW:DOWNLOAD-1.0-http--download'). Are you sure that this not break things in pycsw? I am pretty sure that 'OGC:WMS', 'OGC:WFS', 'OGC:WCS' link type is needed for adding the WMS/WFS in QGIS metasearch.

capooti commented 10 years ago

@garnertb ignore my previous comment, thanks to @simod I have just realized that I was reading a collapsed version of the method in GH :) sorry for the noise

garnertb commented 10 years ago

No problem, @capooti. I'm still confused as to what description is/should be here: https://github.com/GeoNode/geonode/blob/master/geonode/base/models.py#L481.

tomkralidis commented 10 years ago

@garnertb @capooti that should be url.name, not description.

garnertb commented 10 years ago

Awesome, I'll update that. Thanks @tomkralidis!

mwengren commented 10 years ago

@capooti @tomkralidis Sorry, can I hijack this discussion for a minute? What effect do the OGC:WMS, OGC:WFS, and OGC:WCS link types have on the output in GeoNode's CS-W service? I'd expect to see GetCapabilities links inserted into the ISO 19115 metadata records, but on my test instance I don't see any. Here's an example: http://54.221.223.46/catalogue/csw?outputschema=http%3A%2F%2Fwww.isotc211.org%2F2005%2Fgmd&service=CSW&request=GetRecordById&version=2.0.2&elementsetname=full&id=3c2fc093-664d-4104-903b-9a90d761d8b9. There are only the various WMS and WFS output links.

Will this commit fix this and add those missing types to the output? Just wondering how the integration happens with QGIS search or an external catalog without links to the GetCapabilities endpoints in the metadata. Or perhaps my instance needs some updates...

capooti commented 10 years ago

try to run updatelayers -f layername and see if you get the links as a first test, in case your metadata haven't been updated for a while

mwengren commented 10 years ago

@capooti I've run updatelayers recently via daily cron, and the base_links table has lines that include the OGC:WMS and OGC:WFS types for each layer in GeoNode. For ex:

1332;54;"html";"OGC:WFS";"precip_outlook_SON_2013";"text/html";"http://services.ogc.noaa.gov/geoserver/wfs?" 1331;54;"html";"OGC:WMS";"precip_outlook_SON_2013";"text/html";"http://services.ogc.noaa.gov/geoserver/wms?" 1330;54;"png";"image";"Legend";"image/png";"http://services.ogc.noaa.gov/geoserver/wms?request=GetLegendGraphic&format=image/png&WIDTH=20&HEIGHT=20&LAYER=cpc:precip_outlook_SON_2013&legend_options=fontAntiAliasing:true;fontSize:12;forceLabels:on" 1329;54;"png";"image";"Remote Thumbnail";"image/png";"http://services.ogc.noaa.gov/geoserver/wms/reflect?layers=cpc:precip_outlook_SON_2013&width=200&height=150&format=image/png8" 1328;54;"html";"html";"cpc:precip_outlook_SON_2013";"text/html";"http://54.221.223.46/layers/cpc%3Aprecip_outlook_SON_2013" 1327;54;"html";"OGC:WMS";"OWS";"text/html";"http://services.ogc.noaa.gov/geoserver/cpc/precip_outlook_SON_2013/wms" 1326;54;"tiles";"image";"Tiles";"image/png";"http://services.ogc.noaa.gov/geoserver/gwc/service/gmaps?layers=cpc:precip_outlook_SON_2013&zoom={z}&x={x}&y={y}&format=image/png8" 1325;54;"kml";"data";"View in Google Earth";"text/xml";"http://services.ogc.noaa.gov/geoserver/wms/kml?layers=cpc%3Aprecip_outlook_SON_2013&mode=refresh" 1324;54;"kml";"data";"KML";"text/xml";"http://services.ogc.noaa.gov/geoserver/wms/kml?layers=cpc%3Aprecip_outlook_SON_2013&mode=download" etc....

They are links to the generic WMS/WFS endpoints in GeoServer (geoserver/wms/). I would think a workspace-specific link would be more appropriate maybe, such as 'http://services.ogc.noaa.gov/geoserver/cpc/wms?' ? Or maybe I don't understand the intent of these links. I did notice that the second OGC:WMS in the above is invalid for some reason, led me to think it might be a setup problem on my side.

In any case, they don't appear in the ISO output. Are they supposed to? I can troubleshoot some more, just hoping a little help from the experts will get me there quicker. Thanks.

capooti commented 10 years ago

we need @tomkralidis or @kalxas here :)

mwengren commented 10 years ago

May start a thread in geonode-dev instead, that would be a better location. In the meantime I'll update with master and try to debug.

tomkralidis commented 10 years ago

@mwengren yes please raise in geonode-dev.