← Back to team overview

openerp-india team mailing list archive

[Bug 1053964] Re: error in yaml unit test: 'ascii' codec can't decode byte 0xc3 in position 490

 

** Attachment added: "patch"
   https://bugs.launchpad.net/bugs/1053964/+attachment/3327834/+files/patch

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1053964

Title:
  error in yaml unit test:  'ascii' codec can't decode byte 0xc3 in
  position 490

Status in OpenERP Server:
  New

Bug description:
  openerp-6.1-20120920-232239/
  How to reproduce this bug:
  1. Create a data model inherit of osv.osv
  2. Create a openerp xml form view with utf-8 encoding. Use char like 'é' or 'è'
  3. if you test the view in openerp web every thing is good
  4. if you add a unit test in yaml !record on precedent object. the call just load the view on this moment :

  tools/yaml_import.py:347
              context = record.context
              if view_id:
                  varg = view_id
                  if view_id is True: varg = False
                  view = model.fields_view_get(self.cr, 1, varg, 'form', context)
                  view_id = etree.fromstring(view['arch'].encode('utf-8'))

  if i use a pdb after view = model...
  (Pdb) view['arch']
  **just an extract** '<group colspan="4" col="3" string="Information client\xc3\xa8le">\n'
  (pdb) view['arch'].encode('utf-8')
  **just an extract** UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 490: ordinal not in range(128)
  (pdb) view['arch'].decode('utf-8')
  **just an extract**<group colspan="4" col="3" string="Information client\xe8le">\n 
  (Pdb) etree.fromstring.__doc__
  'fromstring(text, parser=None, base_url=None)\n\n    Parses an XML document or fragment from a string.  Returns the\n    root node (or the result returned by a parser target).\n\n    To override the default parser with a different parser you can pass it to\n    the ``parser`` keyword argument.\n\n    The ``base_url`` keyword argument allows to set the original base URL of\n    the document to support relative Paths when looking up external entities\n    (DTD, XInclude, ...).\n
  (Pdb) etree.fromstring(view['arch'].decode('utf-8'))
  <Element form at 0x50008c0>

  thank,
  Simon ANDRÉ

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1053964/+subscriptions


References