예제 #1
0
 def to_portable_primitive(self, val):
     if self.subfield:
         ret = list()
         if val is None:
             return ret
         for item in val:
             ret.append(self.subfield.to_portable_primitive(item))
         #run data through the primitive processor
         return PRIMITIVE_PROCESSOR.to_primitive(ret)
     return PRIMITIVE_PROCESSOR.to_primitive(val)
예제 #2
0
 def to_portable_primitive(self, val):
     ret = dict()
     if val is None:
         return ret
     for key, value in val.iteritems():
         if hasattr(value, 'to_portable_primitive'):
             value = type(value).to_portable_primitive(value)
         if hasattr(key, 'to_portable_primitive'):
             key = type(key).to_portable_primitive(key)
         ret[key] = value
     #TODO run data through the primitive processor
     ret = PRIMITIVE_PROCESSOR.to_primitive(ret)
     return ret