← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 817683] [NEW] caldav try to store unicode string as binary

 

Public bug reported:

Caldav cant import ical files with attach tag with strings values.
Caldav load the value as unicode and try to convert it to binary. It's
invalid by:

http://psycopg.lighthouseapp.com/projects/62710/tickets/51-typeerror-
cant-escape-unicode-to-binary-writing-unicode-into-bytea

Solution:

In addons/caldav/calendar.py append the following lines:

                if 'attach' in map_val and isinstance(map_val['attach'], unicode):
                        map_val['attach'] = map_val['attach'].encode('utf8')

after the lines:
            if field_type == 'many2one':
                id = None
                if not map_val or not isinstance(map_val, dict):
                    vals[field] = id
                    continue
                model = obj.__attribute__[map_dict].get('object', False)
                modobj = obj.pool.get(model)

and before:
                key1 = map_val.keys()
                value1 = map_val.values()

** Affects: openobject-addons
     Importance: Undecided
         Status: New


** Tags: caldav import

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/817683

Title:
  caldav try to store unicode string as binary

Status in OpenERP Modules (addons):
  New

Bug description:
  Caldav cant import ical files with attach tag with strings values.
  Caldav load the value as unicode and try to convert it to binary. It's
  invalid by:

  http://psycopg.lighthouseapp.com/projects/62710/tickets/51-typeerror-
  cant-escape-unicode-to-binary-writing-unicode-into-bytea

  Solution:

  In addons/caldav/calendar.py append the following lines:

                  if 'attach' in map_val and isinstance(map_val['attach'], unicode):
                          map_val['attach'] = map_val['attach'].encode('utf8')

  after the lines:
              if field_type == 'many2one':
                  id = None
                  if not map_val or not isinstance(map_val, dict):
                      vals[field] = id
                      continue
                  model = obj.__attribute__[map_dict].get('object', False)
                  modobj = obj.pool.get(model)

  and before:
                  key1 = map_val.keys()
                  value1 = map_val.values()

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


Follow ups

References