[GeoNode-devel] error during layer upload using GeoNode master (TypeError: can't compare offset-naive and offset-aware datetimes)

Paolo Corti pcorti at gmail.com
Fri Aug 9 11:43:49 PDT 2019


FYI (in case you get the same problem): this error is raised if you
are using USE_TZ = True
As suggested here [1] it looks like oauth2_provider should use
django.utils.timezone.now()

best
Paolo

[1] https://docs.djangoproject.com/en/2.2/topics/i18n/timezones/

On Fri, Aug 9, 2019 at 2:29 PM Paolo Corti <pcorti at gmail.com> wrote:
>
> Hi devs
> when uploading a layer using GeoNode master I am now getting this error:
>
> Traceback (most recent call last):
>   File "/home/ubuntu/geonode/geonode/layers/views.py", line 217, in layer_upload
>     metadata_upload_form=form.cleaned_data["metadata_upload_form"])
>   File "/home/ubuntu/geonode/geonode/layers/utils.py", line 599, in file_upload
>     defaults=defaults
>   File "/home/ubuntu/env/local/lib/python2.7/site-packages/django/db/models/manager.py",
> line 85, in manager_method
>     return getattr(self.get_queryset(), name)(*args, **kwargs)
>   File "/home/ubuntu/env/local/lib/python2.7/site-packages/modeltranslation/manager.py",
> line 413, in get_or_create
>     return super(MultilingualQuerySet, self).get_or_create(**kwargs)
>   File "/home/ubuntu/env/local/lib/python2.7/site-packages/django/db/models/query.py",
> line 466, in get_or_create
>     return self._create_object_from_params(lookup, params)
>   File "/home/ubuntu/env/local/lib/python2.7/site-packages/django/db/models/query.py",
> line 500, in _create_object_from_params
>     obj = self.create(**params)
>   File "/home/ubuntu/env/local/lib/python2.7/site-packages/modeltranslation/manager.py",
> line 405, in create
>     return super(MultilingualQuerySet, self).create(**kwargs)
>   File "/home/ubuntu/env/local/lib/python2.7/site-packages/django/db/models/query.py",
> line 394, in create
>     obj.save(force_insert=True, using=self.db)
>   File "/home/ubuntu/env/local/lib/python2.7/site-packages/polymorphic/models.py",
> line 93, in save
>     return super(PolymorphicModel, self).save(*args, **kwargs)
>   File "/home/ubuntu/env/local/lib/python2.7/site-packages/django/db/models/base.py",
> line 808, in save
>     force_update=force_update, update_fields=update_fields)
>   File "/home/ubuntu/env/local/lib/python2.7/site-packages/django/db/models/base.py",
> line 848, in save_base
>     update_fields=update_fields, raw=raw, using=using,
>   File "/home/ubuntu/env/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py",
> line 193, in send
>     for receiver in self._live_receivers(sender)
>   File "/home/ubuntu/geonode/geonode/decorators.py", line 53, in wrapper
>     return func(*args, **kwargs)
>   File "/home/ubuntu/geonode/geonode/geoserver/signals.py", line 94,
> in geoserver_post_save
>     set_resource_default_links(instance, sender, prune=True)
>   File "/home/ubuntu/geonode/geonode/utils.py", line 1643, in
> set_resource_default_links
>     create_gs_thumbnail(instance, overwrite=True, check_bbox=True)
>   File "/home/ubuntu/geonode/geonode/geoserver/helpers.py", line 2154,
> in create_gs_thumbnail
>     return implementation(instance, overwrite, check_bbox)
>   File "/home/ubuntu/geonode/geonode/layers/utils.py", line 1086, in
> create_gs_thumbnail_geonode
>     if access_token and not access_token.is_expired():
>   File "/home/ubuntu/env/local/lib/python2.7/site-packages/oauth2_provider/models.py",
> line 292, in is_expired
>     return timezone.now() >= self.expires
> TypeError: can't compare offset-naive and offset-aware datetimes
>
> any idea before I start looking into it? (not sure if this was already
> discussed here)
>
> thanks
> Paolo
>
>
> --
> Paolo Corti
> Geospatial software developer
> web: http://www.paolocorti.net
> twitter: @capooti
> skype: capooti
> #drt3jc1



-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti
#drt3jc1


More information about the geonode-devel mailing list