CSS parsing errors with cssutils ≥ 0.9.6

Bug #379409 reported by ThijsVermeir
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Elisa Media Center
Invalid
High
Olivier Tilloy
Moovida
Invalid
High
Unassigned

Bug Description

When running the latest moovida with cssutils version: cssutils-0.9.6a4-py2.5 (don't know if this is important). We see the following errors (multiple). After some investigation it looks that the settings "0px" are read from the styles file as "(int)0". Because of these the following error occures. A simple work around is setting these "0px" values to "1px" with are read correctly as ValueWithUnit, but this will probably change the behaviour of the style.

<type 'exceptions.AttributeError'>
Python 2.5.2: /opt/fluoh/bin/python
Fri May 22 14:28:20 2009

A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /opt/fluoh/elisa/elisa-plugins/elisa/plugins/pigment/widgets/panel.py in do_mapped(self=<BackButtonPanel object at 0xa5ac694 (elisa+plugins+pigment+widgets+widget+Widget at 0xa604f10)>)
   73
   74 def do_mapped(self):
   75 self._update_size()
   76 self._layout()
   77
self = <BackButtonPanel object at 0xa5ac694 (elisa+plugins+pigment+widgets+widget+Widget at 0xa604f10)>
self._update_size = <bound method BackButtonPanel._update_size of <B...ins+pigment+widgets+widget+Widget at 0xa604f10)>>

 /opt/fluoh/elisa/elisa-plugins/elisa/plugins/pigment/widgets/panel.py in _update_size(self=<BackButtonPanel object at 0xa5ac694 (elisa+plugins+pigment+widgets+widget+Widget at 0xa604f10)>)
  147 if not self.is_mapped:
  148 return
  149 self._compute_border_sizes()
  150 self.top_left.set_size(self._left_width, self._top_height)
  151 self.top_right.set_size(self._right_width, self._top_height)
self = <BackButtonPanel object at 0xa5ac694 (elisa+plugins+pigment+widgets+widget+Widget at 0xa604f10)>
self._compute_border_sizes = <bound method BackButtonPanel._compute_border_si...ins+pigment+widgets+widget+Widget at 0xa604f10)>>

 /opt/fluoh/elisa/elisa-plugins/elisa/plugins/pigment/widgets/panel.py in _compute_border_sizes(self=<BackButtonPanel object at 0xa5ac694 (elisa+plugins+pigment+widgets+widget+Widget at 0xa604f10)>)
  138 self._right_width = fx*self.right_width.value
  139
  140 fx, fy = self.get_factors_absolute(self.top_height.unit)
  141 self._top_height = fy*self.top_height.value
  142
fx = 0.3125
fy = 0.31927710771560669
self = <BackButtonPanel object at 0xa5ac694 (elisa+plugins+pigment+widgets+widget+Widget at 0xa604f10)>
self.get_factors_absolute = <bound method BackButtonPanel.get_factors_absolu...ins+pigment+widgets+widget+Widget at 0xa604f10)>>
self.top_height = 0
self.top_height.unit undefined
<type 'exceptions.AttributeError'>: 'int' object has no attribute 'unit'
    __class__ = <type 'exceptions.AttributeError'>
    __delattr__ = <method-wrapper '__delattr__' of exceptions.AttributeError object at 0xb0da5fcc>
    __dict__ = {}
    __doc__ = 'Attribute not found.'
    __getattribute__ = <method-wrapper '__getattribute__' of exceptions.AttributeError object at 0xb0da5fcc>
    __getitem__ = <method-wrapper '__getitem__' of exceptions.AttributeError object at 0xb0da5fcc>
    __getslice__ = <method-wrapper '__getslice__' of exceptions.AttributeError object at 0xb0da5fcc>
    __hash__ = <method-wrapper '__hash__' of exceptions.AttributeError object at 0xb0da5fcc>
    __init__ = <method-wrapper '__init__' of exceptions.AttributeError object at 0xb0da5fcc>
    __new__ = <built-in method __new__ of type object at 0xb7fe05e0>
    __reduce__ = <built-in method __reduce__ of exceptions.AttributeError object at 0xb0da5fcc>
    __reduce_ex__ = <built-in method __reduce_ex__ of exceptions.AttributeError object at 0xb0da5fcc>
    __repr__ = <method-wrapper '__repr__' of exceptions.AttributeError object at 0xb0da5fcc>
    __setattr__ = <method-wrapper '__setattr__' of exceptions.AttributeError object at 0xb0da5fcc>
    __setstate__ = <built-in method __setstate__ of exceptions.AttributeError object at 0xb0da5fcc>
    __str__ = <method-wrapper '__str__' of exceptions.AttributeError object at 0xb0da5fcc>
    args = ("'int' object has no attribute 'unit'",)
    message = "'int' object has no attribute 'unit'"

The above is a description of an error in a Python program. Here is
the original traceback:

Traceback (most recent call last):
  File "/opt/fluoh/elisa/elisa-plugins/elisa/plugins/pigment/widgets/panel.py", line 75, in do_mapped
    self._update_size()
  File "/opt/fluoh/elisa/elisa-plugins/elisa/plugins/pigment/widgets/panel.py", line 149, in _update_size
    self._compute_border_sizes()
  File "/opt/fluoh/elisa/elisa-plugins/elisa/plugins/pigment/widgets/panel.py", line 140, in _compute_border_sizes
    fx, fy = self.get_factors_absolute(self.top_height.unit)
AttributeError: 'int' object has no attribute 'unit'

Tags: developers

Related branches

Changed in elisa:
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Olivier Tilloy (osomon) wrote :

The version of cssutils used seems to be an important factor: the bug is observed with 0.9.6 but not with 0.9.5.

Olivier Tilloy (osomon)
summary: - wrong parsing of styles for BackButtonPanel
+ CSS parsing errors with cssutils ≥ 0.9.6
tags: added: developers
Revision history for this message
Olivier Tilloy (osomon) wrote :

It looks like cssutils, when encountering a rule that contains something like "top_height: 0px", automatically replaces "0px" by "0", assuming 0 is absolute and therefore the unit doesn't matter.

Possible solutions:
1) See if there is a way to tell cssutils not to discard the unit
2) When applying the style properties to the PiecePanel widget, if a value of 0 is given, substitute it with ValueWithUnit(0, "px").

Changed in elisa:
assignee: nobody → Olivier Tilloy (osomon)
importance: Undecided → High
status: New → Confirmed
Olivier Tilloy (osomon)
Changed in elisa:
status: Confirmed → In Progress
Olivier Tilloy (osomon)
Changed in elisa:
status: In Progress → Fix Committed
Revision history for this message
dino99 (9d9) wrote :

The latest free moovida 1.09 does not get any maintenance since a while. Now moovidadb.com is supporting Linux and support can be found at : http://www.fluendo.com/faq/

Changed in elisa:
status: Fix Committed → Invalid
Changed in moovida:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.