[GeoNode-users] Encoding problem in Metadata
Alessio Fabiani
alessio.fabiani at geo-solutions.it
Thu Sep 13 01:00:38 PDT 2018
Hi David,
so the issue happens in this method, probably in the context preparation
https://github.com/GeoNode/geonode/blob/master/geonode/layers/views.py#L798
*WARNING:* your code will be different
>From the stack trace basically there should be a non ASCII character
somewhere on the metadata fields which cause issue to the Django template.
Probably a keyword? You should be able to identify the strange characters
from the metadata XML.
However, basically, once you identified which attribute is causing the
issue, you should be able to go to the Layers Models or Base ResourceBase
Models and add a line of code like this one
<whatever_attribute_causing_issue>.encode("utf-8")
Try if this might fix the problem.
Il giorno gio 13 set 2018 alle ore 03:47 Daniel Victoria <
daniel.victoria at gmail.com> ha scritto:
> Hi Alessio,
>
> By 'compare with the code base' you mean checkout the 2.7.x branch and see
> what changed from my current install? And how will I know which changes
> will fix this problem?
>
> Regarding the Issue, I'll try to open one up tomorrow
>
> Cheers
> Daniel
>
> On Wed, Sep 12, 2018 at 11:42 AM Alessio Fabiani <
> alessio.fabiani at geo-solutions.it> wrote:
>
>> Hello Daniel,
>> I guess this issue has been fixed on 2.7.x branch already. Any chance to
>> compare with the code base?
>>
>> If not let me know, I'll try to extract the fix.
>>
>> Also, could be useful if we track this discussion on an issue on GitHub.
>>
>>
>>
>> Il giorno mer 12 set 2018 alle ore 14:20 Daniel Victoria <
>> daniel.victoria at gmail.com> ha scritto:
>>
>>> Hi list,
>>>
>>> I have GeoNode 2.8 installed from package in Ubuntu.
>>>
>>> I uploaded several shapefiles along with their metadata in a xml file
>>> using `geonode importlayers` command. Everything worked fine and I can see
>>> the metadata using the `Metadata detail` button, including the accented
>>> characters in the title and keywords field. But when I try to edit the
>>> metadata (Edit layers \ metadata wizard) I get an error. Looking at the
>>> apache error log, is mentions a problem with encoding.
>>>
>>> Any idea how to fix this? Bellow is the apache error log
>>>
>>> Cheers
>>> Daniel
>>>
>>> --- Apache error log ---
>>> [Wed Sep 12 06:55:17.755914 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] Internal Server Error:
>>> /layers/geonode:go1_a01_2014_lasboundary/metadata
>>> [Wed Sep 12 06:55:17.755940 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] Traceback (most recent call last):
>>> [Wed Sep 12 06:55:17.755945 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 132,
>>> in get_response
>>> [Wed Sep 12 06:55:17.755955 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] response = wrapped_callback(request, *callback_args,
>>> **callback_kwargs)
>>> [Wed Sep 12 06:55:17.755959 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/contrib/auth/decorators.py", line
>>> 22, in _wrapped_view
>>> [Wed Sep 12 06:55:17.755962 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return view_func(request, *args, **kwargs)
>>> [Wed Sep 12 06:55:17.755965 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/local/lib/python2.7/dist-packages/geonode/layers/views.py", line
>>> 1093, in layer_metadata
>>> [Wed Sep 12 06:55:17.755969 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] getattr(settings, 'GROUP_MANDATORY_RESOURCES', False),
>>> [Wed Sep 12 06:55:17.755972 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/shortcuts.py", line 67, in render
>>> [Wed Sep 12 06:55:17.755975 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] template_name, context, request=request, using=using)
>>> [Wed Sep 12 06:55:17.755978 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/loader.py", line 99, in
>>> render_to_string
>>> [Wed Sep 12 06:55:17.755981 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return template.render(context, request)
>>> [Wed Sep 12 06:55:17.755984 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/backends/django.py", line
>>> 74, in render
>>> [Wed Sep 12 06:55:17.755988 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return self.template.render(context)
>>> [Wed Sep 12 06:55:17.755991 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 210, in
>>> render
>>> [Wed Sep 12 06:55:17.755994 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return self._render(context)
>>> [Wed Sep 12 06:55:17.755997 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 202, in
>>> _render
>>> [Wed Sep 12 06:55:17.756000 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return self.nodelist.render(context)
>>> [Wed Sep 12 06:55:17.756003 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 905, in
>>> render
>>> [Wed Sep 12 06:55:17.756006 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] bit = self.render_node(node, context)
>>> [Wed Sep 12 06:55:17.756009 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/debug.py", line 79, in
>>> render_node
>>> [Wed Sep 12 06:55:17.756012 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return node.render(context)
>>> [Wed Sep 12 06:55:17.756015 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/loader_tags.py", line
>>> 135, in render
>>> [Wed Sep 12 06:55:17.756019 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return compiled_parent._render(context)
>>> [Wed Sep 12 06:55:17.756022 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 202, in
>>> _render
>>> [Wed Sep 12 06:55:17.756025 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return self.nodelist.render(context)
>>> [Wed Sep 12 06:55:17.756028 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 905, in
>>> render
>>> [Wed Sep 12 06:55:17.756031 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] bit = self.render_node(node, context)
>>> [Wed Sep 12 06:55:17.756034 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/debug.py", line 79, in
>>> render_node
>>> [Wed Sep 12 06:55:17.756037 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return node.render(context)
>>> [Wed Sep 12 06:55:17.756040 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/loader_tags.py", line
>>> 135, in render
>>> [Wed Sep 12 06:55:17.756046 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return compiled_parent._render(context)
>>> [Wed Sep 12 06:55:17.756050 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 202, in
>>> _render
>>> [Wed Sep 12 06:55:17.756053 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return self.nodelist.render(context)
>>> [Wed Sep 12 06:55:17.756056 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 905, in
>>> render
>>> [Wed Sep 12 06:55:17.756059 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] bit = self.render_node(node, context)
>>> [Wed Sep 12 06:55:17.756062 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/debug.py", line 79, in
>>> render_node
>>> [Wed Sep 12 06:55:17.756065 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return node.render(context)
>>> [Wed Sep 12 06:55:17.756068 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/loader_tags.py", line
>>> 135, in render
>>> [Wed Sep 12 06:55:17.756071 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return compiled_parent._render(context)
>>> [Wed Sep 12 06:55:17.756075 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 202, in
>>> _render
>>> [Wed Sep 12 06:55:17.756078 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return self.nodelist.render(context)
>>> [Wed Sep 12 06:55:17.756081 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 905, in
>>> render
>>> [Wed Sep 12 06:55:17.756084 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] bit = self.render_node(node, context)
>>> [Wed Sep 12 06:55:17.756087 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/debug.py", line 79, in
>>> render_node
>>> [Wed Sep 12 06:55:17.756090 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return node.render(context)
>>> [Wed Sep 12 06:55:17.756093 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/loader_tags.py", line 65,
>>> in render
>>> [Wed Sep 12 06:55:17.756096 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] result = block.nodelist.render(context)
>>> [Wed Sep 12 06:55:17.756099 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 905, in
>>> render
>>> [Wed Sep 12 06:55:17.756102 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] bit = self.render_node(node, context)
>>> [Wed Sep 12 06:55:17.756105 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/debug.py", line 79, in
>>> render_node
>>> [Wed Sep 12 06:55:17.756109 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return node.render(context)
>>> [Wed Sep 12 06:55:17.756112 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/loader_tags.py", line 65,
>>> in render
>>> [Wed Sep 12 06:55:17.756115 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] result = block.nodelist.render(context)
>>> [Wed Sep 12 06:55:17.756118 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 905, in
>>> render
>>> [Wed Sep 12 06:55:17.756121 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] bit = self.render_node(node, context)
>>> [Wed Sep 12 06:55:17.756124 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/debug.py", line 79, in
>>> render_node
>>> [Wed Sep 12 06:55:17.756127 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return node.render(context)
>>> [Wed Sep 12 06:55:17.756130 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/floppyforms/templatetags/floppyforms.py",
>>> line 500, in render
>>> [Wed Sep 12 06:55:17.756136 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] output = nodelist.render(context)
>>> [Wed Sep 12 06:55:17.756139 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 212, in
>>> render
>>> [Wed Sep 12 06:55:17.756142 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return self._render(context)
>>> [Wed Sep 12 06:55:17.756145 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 202, in
>>> _render
>>> [Wed Sep 12 06:55:17.756148 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return self.nodelist.render(context)
>>> [Wed Sep 12 06:55:17.756151 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 905, in
>>> render
>>> [Wed Sep 12 06:55:17.756154 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] bit = self.render_node(node, context)
>>> [Wed Sep 12 06:55:17.756158 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/debug.py", line 79, in
>>> render_node
>>> [Wed Sep 12 06:55:17.756161 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return node.render(context)
>>> [Wed Sep 12 06:55:17.756164 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/loader_tags.py", line 56,
>>> in render
>>> [Wed Sep 12 06:55:17.756167 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] result = self.nodelist.render(context)
>>> [Wed Sep 12 06:55:17.756170 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/base.py", line 905, in
>>> render
>>> [Wed Sep 12 06:55:17.756173 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] bit = self.render_node(node, context)
>>> [Wed Sep 12 06:55:17.756176 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/debug.py", line 79, in
>>> render_node
>>> [Wed Sep 12 06:55:17.756179 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return node.render(context)
>>> [Wed Sep 12 06:55:17.756182 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/template/debug.py", line 92, in
>>> render
>>> [Wed Sep 12 06:55:17.756186 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] output = force_text(output)
>>> [Wed Sep 12 06:55:17.756189 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/utils/encoding.py", line 92, in
>>> force_text
>>> [Wed Sep 12 06:55:17.756192 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] s = six.text_type(s)
>>> [Wed Sep 12 06:55:17.756195 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/utils/html.py", line 404, in
>>> <lambda>
>>> [Wed Sep 12 06:55:17.756198 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] klass.__unicode__ = lambda self:
>>> mark_safe(klass_unicode(self))
>>> [Wed Sep 12 06:55:17.756201 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/forms/forms.py", line 537, in
>>> __str__
>>> [Wed Sep 12 06:55:17.756204 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return self.as_widget()
>>> [Wed Sep 12 06:55:17.756207 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/lib/python2.7/dist-packages/django/forms/forms.py", line 593, in
>>> as_widget
>>> [Wed Sep 12 06:55:17.756211 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] return force_text(widget.render(name, self.value(),
>>> attrs=attrs))
>>> [Wed Sep 12 06:55:17.756214 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] File
>>> "/usr/local/lib/python2.7/dist-packages/geonode/base/forms.py", line 115,
>>> in render
>>> [Wed Sep 12 06:55:17.756217 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] vals = ','.join([str(i.tag.name) for i in values])
>>> [Wed Sep 12 06:55:17.756220 2018] [wsgi:error] [pid 30108:tid
>>> 139760428979968] UnicodeEncodeError: 'ascii' codec can't encode character
>>> u'\\xe1' in position 3: ordinal not in range(128)
>>>
>>>
>>> _______________________________________________
>>> geonode-users mailing list
>>> geonode-users at lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/geonode-users
>>>
>>
>>
>> --
>>
>> ==
>>
>> GeoServer Professional Services from the experts! Visit
>> http://goo.gl/it488V for more information.
>> ==
>> Ing. Alessio Fabiani
>>
>> @alfa7691
>> Founder/Technical Lead
>>
>>
>> GeoSolutions S.A.S.
>> Via di Montramito 3/A -
>> <https://maps.google.com/?q=Via+di+Montramito+3/A+-++55054+%C2%A0Massarosa&entry=gmail&source=g>55054
>> Massarosa
>> <https://maps.google.com/?q=Via+di+Montramito+3/A+-++55054+%C2%A0Massarosa&entry=gmail&source=g>
>> (LU) - Italy
>> phone: +39 0584 962313 <+39%200584%20962313>
>> fax: +39 0584 1660272 <+39%200584%20166%200272>
>> mob: +39 331 6233686 <+39%20331%20623%203686>
>>
>>
>> http://www.geo-solutions.it
>> http://twitter.com/geosolutions_it
>> -------------------------------------------------------
>>
>> Con riferimento alla normativa sul trattamento dei dati personali (Reg.
>> UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
>> precisa che ogni circostanza inerente alla presente email (il suo
>> contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
>> riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
>> messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
>> operazione è illecita. Le sarei comunque grato se potesse darmene notizia.
>>
>>
>> This email is intended only for the person or entity to which it is
>> addressed and may contain information that is privileged, confidential or
>> otherwise protected from disclosure. We remind that - as provided by
>> European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
>> e-mail or the information herein by anyone other than the intended
>> recipient is prohibited. If you have received this email by mistake, please
>> notify us immediately by telephone or e-mail.
>>
> _______________________________________________
> geonode-users mailing list
> geonode-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geonode-users
>
--
==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information.
==
Ing. Alessio Fabiani
@alfa7691
Founder/Technical Lead
GeoSolutions S.A.S.
Via di Montramito 3/A - 55054 Massarosa (LU) - Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 331 6233686
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
precisa che ogni circostanza inerente alla presente email (il suo
contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
operazione è illecita. Le sarei comunque grato se potesse darmene notizia.
This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by
European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
e-mail or the information herein by anyone other than the intended
recipient is prohibited. If you have received this email by mistake, please
notify us immediately by telephone or e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20180913/74349c25/attachment-0001.html>
More information about the geonode-users
mailing list