Skip to content

Commit

Permalink
Fixes PEP8 violations and a syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
capooti committed May 30, 2018
1 parent 8a6ba6a commit b590fa7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
15 changes: 13 additions & 2 deletions geonode/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,25 +175,36 @@ def resource_urls(request):
defaults['GEONODE_CLIENT_LOCATION'] = getattr(
settings,
'GEONODE_CLIENT_LOCATION',
'/static/worldmap/worldmap_client/')
'/static/worldmap/worldmap_client/'
)

# TODO disable DB_DATASTORE setting
defaults['DB_DATASTORE'] = True

defaults['HYPERMAP_REGISTRY_URL'] = settings.HYPERMAP_REGISTRY_URL

defaults['MAPPROXY_URL'] = settings.HYPERMAP_REGISTRY_URL

defaults['SOLR_URL'] = settings.SOLR_URL

defaults['USE_GAZETTEER'] = settings.USE_GAZETTEER
defaults['GOOGLE_API_KEY'] = settings.GOOGLE_API_KEY,

defaults['GOOGLE_API_KEY'] = settings.GOOGLE_API_KEY

defaults['GOOGLE_MAPS_API_KEY'] = settings.GOOGLE_MAPS_API_KEY

defaults['WM_COPYRIGHT_URL'] = getattr(
settings,
'WM_COPYRIGHT_URL',
'http://gis.harvard.edu/'
)

defaults['WM_COPYRIGHT_TEXT'] = getattr(
settings,
'WM_COPYRIGHT_TEXT',
'Center for Geographic Analysis'
)

defaults['HYPERMAP_REGISTRY_URL'] = settings.HYPERMAP_REGISTRY_URL

return defaults
1 change: 1 addition & 0 deletions geonode/contrib/worldmap/gazetteer/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ class GazetteerAttributeAdmin(admin.ModelAdmin):
'date_format',
)


admin.site.register(GazetteerEntry, GazetteerEntryAdmin)
admin.site.register(GazetteerAttribute, GazetteerAttributeAdmin)
6 changes: 5 additions & 1 deletion geonode/contrib/worldmap/gazetteer/flexidates.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@

class FlexiDateField(models.Field):
empty_strings_allowed = False

default_error_messages = {
'invalid': _(u"'%s' value has an invalid date format. Acceptable formats include "
u"YYYY-MM-DD where YYYY = year (at least 4 digits, use"
u"0001 for year 1), MM = month (1-12, optional),"
u" DD = day of month (1-31, optional)."
u"For BC dates insert a minus sign before year (-1000-01-01)"
u" or append with BC (1000-01-01 BC).")
}
}

description = _("Date BC/AD (without time)")

def __init__(self, verbose_name=None, name=None, auto_now=False,
Expand Down Expand Up @@ -73,6 +75,7 @@ def value_to_string(self, obj):

def formfield(self, **kwargs):
defaults = {'form_class': FlexiDateFormField}

defaults.update(kwargs)
return super(FlexiDateField, self).formfield(**defaults)

Expand Down Expand Up @@ -118,6 +121,7 @@ def _has_changed(self, initial, data):

class FlexiDateFormField(forms.Field):
widget = FlexiDateInput

default_error_messages = {
'invalid': _(u"Invalid date format. Try a format of YYYY-MM-DD where YYYY = year (mandatory), "
u"MM = month (1-12, optional), DD = day of month (1-31, optional). For BC dates "
Expand Down
6 changes: 3 additions & 3 deletions geonode/contrib/worldmap/gazetteer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def getGazetteerResults(place_name, map=None, layer=None, start_date=None, end_d
try:
layer = Layer.objects.get(typename=maplayer.name)
layers.append(layer.name)
except:
except Exception:
logger.info("Could not find %s", maplayer.name)

elif layer:
Expand Down Expand Up @@ -409,7 +409,7 @@ def getNominatimResults(place_name):
for result in results:
formatted_results.append(formatExternalGeocode('Nominatim', result))
return formatted_results
except:
except Exception:
return []


Expand All @@ -433,7 +433,7 @@ def getGeonamesResults(place_name):
for result in results:
formatted_results.append(formatExternalGeocode('Geonames', result))
return formatted_results
except:
except Exception:
return []


Expand Down
2 changes: 1 addition & 1 deletion geonode/people/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ class Meta:
'username',
'is_staff',
'is_superuser',
'is_active'
'is_active',
'date_joined'
)

0 comments on commit b590fa7

Please sign in to comment.