server/sqlutils.py
changeset 10662 10942ed172de
parent 10651 9ca33768473c
child 10760 c34bbdb18745
equal deleted inserted replaced
10661:e6eb0c7c2e98 10662:10942ed172de
   371                     raise Exception('Failed command: %s' % cmd)
   371                     raise Exception('Failed command: %s' % cmd)
   372 
   372 
   373     def merge_args(self, args, query_args):
   373     def merge_args(self, args, query_args):
   374         if args is not None:
   374         if args is not None:
   375             newargs = {}
   375             newargs = {}
   376             for key, val in args.iteritems():
   376             for key, val in args.items():
   377                 # convert cubicweb binary into db binary
   377                 # convert cubicweb binary into db binary
   378                 if isinstance(val, Binary):
   378                 if isinstance(val, Binary):
   379                     val = self._binary(val.getvalue())
   379                     val = self._binary(val.getvalue())
   380                 # convert timestamp to utc.
   380                 # convert timestamp to utc.
   381                 # expect SET TiME ZONE to UTC at connection opening time.
   381                 # expect SET TiME ZONE to UTC at connection opening time.
   442         to insert/update an entity into a SQL database
   442         to insert/update an entity into a SQL database
   443         """
   443         """
   444         attrs = {}
   444         attrs = {}
   445         eschema = entity.e_schema
   445         eschema = entity.e_schema
   446         converters = getattr(self.dbhelper, 'TYPE_CONVERTERS', {})
   446         converters = getattr(self.dbhelper, 'TYPE_CONVERTERS', {})
   447         for attr, value in entity.cw_edited.iteritems():
   447         for attr, value in entity.cw_edited.items():
   448             if value is not None and eschema.subjrels[attr].final:
   448             if value is not None and eschema.subjrels[attr].final:
   449                 atype = str(entity.e_schema.destination(attr))
   449                 atype = str(entity.e_schema.destination(attr))
   450                 if atype in converters:
   450                 if atype in converters:
   451                     # It is easier to modify preprocess_entity rather
   451                     # It is easier to modify preprocess_entity rather
   452                     # than add_entity (native) as this behavior
   452                     # than add_entity (native) as this behavior