Joël,

The module throws an exception if one inserts a user which an accoent in the 
name, for example Véronique.

  File 
"/opt/openerp.bzr/server/bin/addons/c2c_contact_to_ldap/partner.py", line 125, 
in write
    self.updateLdapContact(id,vals,cr,uid,context)
  File 
"/opt/openerp.bzr/server/bin/addons/c2c_contact_to_ldap/partner.py", line 391, 
in updateLdapContact
    self.saveLdapContact(id,vals,cr,uid,context)
  File 
"/opt/openerp.bzr/server/bin/addons/c2c_contact_to_ldap/partner.py", line 373, 
in saveLdapContact
    contact_obj = self.mappLdapObject(id,vals,cr,uid,context)
  File 
"/opt/openerp.bzr/server/bin/addons/c2c_contact_to_ldap/partner.py", line 307, 
in mappLdapObject
    cn = vals['lastname'] +' '+ vals['firstname']
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: 
ordinal not in range(128)
Looking at the code, the error is here:
        if 'lastname' in keys and 'firstname' in keys \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and vals&#91;'firstname'&#93; <> 
False \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and vals&#91;'lastname'&#93; <> 
False&#58;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cn = vals&#91;'lastname'&#93; +' '+ 
vals&#91;'firstname'&#93;

I had a similar problem with a script of my own. For that I wrote a little 
function t() and encapsulated all strings to print in that.
&nbsp; ## Print accents in a string
def t&#40;string&#41;&#58;
&nbsp; if type&#40;string&#41; == unicode&#58;
&nbsp; &nbsp; return string.encode&#40;"latin1"&#41;
&nbsp; return string

Thendo something like:
part_name = t(partner_obj.browse(cr,uid,vals['partner_id']).name)

Hmm. Its not that simple though, Any suggestions?




-------------------- m2f --------------------

--
http://www.openobject.com/forum/viewtopic.php?p=51993#51993

-------------------- m2f --------------------


_______________________________________________
Tinyerp-users mailing list
http://tiny.be/mailman2/listinfo/tinyerp-users

Reply via email to