Changeset 25:35f67e320b88

Show
Ignore:
Timestamp:
07/23/08 12:19:49 (5 years ago)
Author:
Nicolas Evrard <nicoe@…>
Branch:
default
Message:

- Support the case where the image: expression contains a quote or guillemet

Location:
relatorio
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • relatorio/templates/odt.py

    r24 r25  
    1919############################################################################### 
    2020 
    21 __revision__ = "$Id: odt.py 25 2008-07-23 10:38:25Z nicoe $" 
     21__revision__ = "$Id: odt.py 26 2008-07-23 12:19:49Z nicoe $" 
    2222__metaclass__ = type 
    2323 
     
    177177            d_name = draw.attrib['{%s}name' % self.namespaces['draw']] 
    178178            if d_name.startswith('image: '): 
    179                 attr_expr = "make_href(%s, '%s')" % (d_name[7:], d_name[7:]) 
     179                attr_expr = "make_href(%s, %r)" % (d_name[7:], d_name[7:]) 
    180180                attributes = {} 
    181181                attributes['{%s}attrs' % self.namespaces['py']] = attr_expr 
  • relatorio/tests/test_odt.py

    r24 r25  
    2020############################################################################### 
    2121 
    22 __revision__ = "$Id: test_odt.py 25 2008-07-23 10:38:25Z nicoe $" 
     22__revision__ = "$Id: test_odt.py 26 2008-07-23 12:19:49Z nicoe $" 
    2323 
    2424import os 
     
    6565                                (file(os.path.join(thisdir, 'two.png')), 
    6666                                 'image/png')], 
     67                     'oeuf': file(os.path.join(thisdir, 'egg.jpg')), 
    6768                     'footer': u'We sell stuffs'} 
    6869 
     
    125126        root = tree.getroot() 
    126127        images = root.xpath('//draw:frame', namespaces=self.oot.namespaces) 
    127         eq_(len(images), 2) 
     128        eq_(len(images), 3) 
    128129        eq_(images[0].attrib['{%s}name' % self.oot.namespaces['draw']], 
     130            "image: (oeuf, 'image/png')") 
     131        eq_(images[1].attrib['{%s}name' % self.oot.namespaces['draw']], 
    129132            'image: img') 
    130         eq_(images[0].attrib['{%s}width' % self.oot.namespaces['svg']], 
    131             '1.732cm') 
    132         eq_(images[0].attrib['{%s}height' % self.oot.namespaces['svg']], 
    133             '1.513cm') 
    134133        eq_(images[1].attrib['{%s}width' % self.oot.namespaces['svg']], 
    135134            '1.732cm') 
    136135        eq_(images[1].attrib['{%s}height' % self.oot.namespaces['svg']], 
    137136            '1.513cm') 
     137        eq_(images[2].attrib['{%s}width' % self.oot.namespaces['svg']], 
     138            '1.732cm') 
     139        eq_(images[2].attrib['{%s}height' % self.oot.namespaces['svg']], 
     140            '1.513cm')