ctrl-alt-d / django-aula

Gestió de presencia, incidències i més en centres educatius i acadèmies.
Other
18 stars 28 forks source link

Problema en imprimir reports (.odt) #67

Closed juaky closed 5 years ago

juaky commented 5 years ago

Problema en imprimir reports (.odt)

Si s'intenta generar un report (per exemple el corresponent a la impresió dels fulls de pagament d'una sortida) imagen

es produeix un error de codificació

Internal Server Error: /sortides/imprimir/7/4

UnicodeEncodeError at /sortides/imprimir/7/4 'ascii' codec can't encode character '\xe0' in position 29: ordinal not in range(128) Request Method: GET Request URL: https://blablablas.net/sortides/imprimir/7/4 Django Version: 2.2.5 Python Executable: /usr/bin/python3 Python Version: 3.6.8

L'error és molt clar i típic en un traspàs de Pyton2 a 3: problema amb algun caràcter en català.

Traceback:

File "/a/venv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner

  1. response = get_response(request)

File "/a/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. response = self.process_exception_by_middleware(e, request)

File "/a/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/a/venv/lib/python3.6/site-packages/django/contrib/auth/decorators.py" in _wrapped_view

  1. return view_func(request, *args, **kwargs)

File "/a/aula/utils/decorators.py" in inner_decorator

  1. return func(request, *args, **kwargs)

File "/a/aula/apps/sortides/views.py" in imprimir

  1. renderer.run()

File "/a/venv/lib/python3.6/site-packages/appy/pod/renderer.py" in run

  1. self.currentParser.parse(self.contentXml)

File "/a/venv/lib/python3.6/site-packages/appy/xml/init.py" in parse

  1. self.parser.parse(inputSource)

File "/usr/lib/python3.6/xml/sax/expatreader.py" in parse

  1. xmlreader.IncrementalParser.parse(self, source)

File "/usr/lib/python3.6/xml/sax/xmlreader.py" in parse

  1. self.feed(buffer)

File "/usr/lib/python3.6/xml/sax/expatreader.py" in feed

  1. self._parser.Parse(data, isFinal)

File "../Modules/pyexpat.c" in StartElement

File "/usr/lib/python3.6/xml/sax/expatreader.py" in start_element

  1. self._cont_handler.startElement(name, AttributesImpl(attrs))

File "/a/venv/lib/python3.6/site-packages/appy/pod/pod_parser.py" in startElement

  1. e.currentBuffer.dumpStartElement(elem, attrs)

File "/a/venv/lib/python3.6/site-packages/appy/pod/buffers.py" in dumpStartElement

  1. self.write(' %s=%s' % (name, quoteattr(value)))

File "/a/venv/lib/python3.6/site-packages/appy/pod/buffers.py" in write

  1. self.content.write(something)

Podría ser problema del apy pod utilitzat per generar el fitxer .odt?

El problema apareix amb el djAu executant-se en un Ubuntu Server 18.04LTS (language = ca_ES), en canvi no s'ha pogut reproduir l'error (funciona perfectament) en un Xubuntu 18.04 (language = ca_ES).

Any idea¿¿??

juaky commented 5 years ago

Sembla que algú, en el seu dia va tenir el mateix problema: https://github.com/lino-framework/appypod/issues/4

ctrl-alt-d commented 5 years ago

Relacionat: #55

juaky commented 5 years ago

Genial!!! Gràcies!!! imagen