Project

General

Profile

Bug #24301

erreurs lors du parsing des propriétés CSS

Added by Serghei Mihai almost 2 years ago. Updated over 1 year ago.

Status:
Nouveau
Priority:
Haut
Assignee:
Target version:
-
Start date:
05 Jun 2018
Due date:
% Done:

0%

Patch proposed:
No
Planning:
No

Description

CSSStyleDeclaration: Unexpected token, ignoring upto u'--webkit-border-top-right-radius:20px;'. [1:135: -]

Request repr(): 
<WSGIRequest
path:/manage/announce/email/10/,
GET:<QueryDict: {}>,
POST:<QueryDict: {u'csrfmiddlewaretoken': [u'Tq2E00qYDAjDCrngRD2MebGnEn4wsISJ'], u'email': [u'aude@meritza.fr']}>,
COOKIES:{'A2_OPENED_SESSION': '1',
 'MELLON_PASSIVE_TRIED': '1',
 'csrftoken-d44a58': 'Tq2E00qYDAjDCrngRD2MebGnEn4wsISJ',
 'gadjo_sidepage_status': 'expanded',
 'hasConsent': 'true',
 'publik_portal_agent_title': 'Portail%20agents',
 'publik_portal_agent_url': 'https%3A%2F%2Fagents.meyzieu.fr%2F',
 'sessionid-d44a58': 'arheq7zduf60nm78uz7qntrq7lc1vnmk',
 'wcs-882b0c': 'e7ada7754d4cce1c'},
META:{'CONTENT_LENGTH': '76',
 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
 u'CSRF_COOKIE': u'Tq2E00qYDAjDCrngRD2MebGnEn4wsISJ',
 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate, br',
 'HTTP_ACCEPT_LANGUAGE': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
 'HTTP_CONNECTION': 'close',
 'HTTP_COOKIE': 'publik_portal_agent_url=https%3A%2F%2Fagents.meyzieu.fr%2F; publik_portal_agent_title=Portail%20agents; csrftoken-d44a58=Tq2E00qYDAjDCrngRD2MebGnEn4wsISJ; gadjo_sidepage_status=expanded; hasConsent=true; A2_OPENED_SESSION=1; MELLON_PASSIVE_TRIED=1; wcs-882b0c="e7ada7754d4cce1c"; sessionid-d44a58=arheq7zduf60nm78uz7qntrq7lc1vnmk',
 'HTTP_HOST': 'infolettres.meyzieu.fr',
 'HTTP_REFERER': 'https://infolettres.meyzieu.fr/manage/announce/10/',
 'HTTP_UPGRADE_INSECURE_REQUESTS': '1',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0',
 'HTTP_X_FORWARDED_FOR': '62.193.38.6',
 'HTTP_X_FORWARDED_PROTO': 'https',
 'HTTP_X_FORWARDED_PROTOCOL': 'ssl',
 'HTTP_X_FORWARDED_SSL': 'on',
 'HTTP_X_REAL_IP': '62.193.38.6',
 'PATH_INFO': u'/manage/announce/email/10/',
 'QUERY_STRING': '',
 'RAW_URI': '/manage/announce/email/10/',
 'REMOTE_ADDR': '62.193.38.6',
 'REQUEST_METHOD': 'POST',
 'SCRIPT_NAME': u'',
 'SERVER_NAME': 'infolettres.meyzieu.fr',
 'SERVER_PORT': '443',
 'SERVER_PROTOCOL': 'HTTP/1.0',
 'SERVER_SOFTWARE': 'gunicorn/19.6.0',
 'gunicorn.socket': <socket._socketobject object at 0x7ff1f7626c20>,
 'wsgi.errors': <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7ff1f601c550>,
 'wsgi.file_wrapper': <class 'gunicorn.http.wsgi.FileWrapper'>,
 'wsgi.input': <gunicorn.http.body.Body object at 0x7ff1f60639d0>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'https',
 'wsgi.version': (1, 0)}>

History

#1 Updated by Serghei Mihai over 1 year ago

  • Priority changed from Normal to Haut
  • Assignee set to Serghei Mihai

#2 Updated by Thomas Noël over 1 year ago

à toutes fins utiles, vu dans le code de Premailer qui est appelé par load_and_transform :

class Premailer(object):

    attribute_name = 'data-premailer'

    def __init__(self, html, base_url=None,
                 disable_link_rewrites=False,
                 preserve_internal_links=False,
                 preserve_inline_attachments=True,
                 exclude_pseudoclasses=True,
                 keep_style_tags=False,
                 include_star_selectors=False,
                 remove_classes=False,
                 capitalize_float_margin=False,
                 strip_important=True,
                 external_styles=None,
                 css_text=None,
                 method="html",
                 base_path=None,
                 disable_basic_attributes=None,
                 disable_validation=False,
                 cache_css_parsing=True,
                 cssutils_logging_handler=None,
                 cssutils_logging_level=None,
                 disable_leftover_css=False,
                 align_floating_images=True,
                 remove_unset_properties=True):
...

voir si cssutils_logging_handler est le bon truc, à remplacer par un nullmailer bien senti et voir si ces logs passent à la trappe, ou bien les envoyer à un logger qui mail pas en cas de log.error, ou un truc dans le genre, no sé

#3 Updated by Serghei Mihai over 1 year ago

Le plus simple est de désactiver les logs de parsing des CSS:

import cssutils
cssutils.log.enabled = False

Cela n'aura pas d'incidence puisque même quand une erreur de parsing est levée le parsing n'échoue pas, le style est laissé tel quel.

Also available in: Atom PDF