Error when subscribing using subscription porltlet

Reported by Mr. Jolly on 2009-08-07
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Singing & Dancing
Undecided
Unassigned

Bug Description

The issue is with StoneageHTML and the cssutils package that it uses. The latest version cssutils 0.9.6b3 causes the problems. Pinning version cssutils=0.9.6b1 in the buildout fixes this.

This happens when you have added a style sheet (well, some css lines) in the composer. It can be tested simply by rendering the preview of the news letter. Using cssutils=0.9.6b1 indeed fixes it for me too. But that gives problems with some css lines; for example with this css it fails too:

   * {
    margin: 0;
    padding: 0;
   }

Those lines are given to me by the local css guru, so I assume they are fine. :-)

Traceback is then this, apparently because '*' is not recognized by StoneageHTML as a selector:

Traceback (innermost last):
  Module ZPublisher.Publish, line 119, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module Products.PDBDebugMode.pdbzope.runcall, line 60, in pdb_runcall
  Module ZPublisher.Publish, line 42, in call_object
  Module collective.dancing.browser.preview, line 67, in __call__
  Module collective.singing.scheduler, line 109, in render_message
  Module collective.dancing.composer, line 230, in render
  Module plone.memoize.volatile, line 272, in replacement
  Module collective.dancing.composer, line 220, in _render
  Module stoneagehtml.stoneagehtml, line 91, in compactify
  Module stoneagehtml.stoneagehtml, line 228, in compactify
  Module stoneagehtml.stoneagehtml, line 271, in distributeCSSDeclaration
  Module stoneagehtml.stoneagehtml, line 292, in distributeCSSRule
IndexError: list index out of range

Might it be a good idea to use stoneagehtml only when it works and just use the original html otherwise? So something like this:

html = method_to_render_original_html()
try:
    html = stoneagehtml.compactify(html).decode('utf-8')
except:
    logger.warn('Exception while compacting html with stoneagehtml; using original instead.')

I fixed this in revision 118433 and 118435 by adding a function 'compactify' in collective/dancing/utils.py with the try/except, and using that instead of using stoneagehtml directly.

Changed in singing-dancing:
status: New → Fix Committed
Changed in singing-dancing:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers