Re: JSON type caster

Поиск
Список
Период
Сортировка
От Tobias Oberstein
Тема Re: JSON type caster
Дата
Msg-id 5058D6B1.1070902@gmail.com
обсуждение исходный текст
Ответ на Re: JSON type caster  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список psycopg
>>        #o = json.loads(value)
>>        o = simplejson.loads(value, use_decimal = True)
>
> I think this should be dependent on the Python version and use either
> the builtin module or simplejson where not available. The loads
> function should be probably exposed to the customer for better
> customization of the result. So, all in all, I think psycopg should

Yes, absolutely right. To allow serialization of decimal, datetime and
even custom classes ..

>>        return o
>>     except:
>>        raise InterfaceError("bad JSON representation: %r" % value)
>
> Probably should be DataError. Not sure it is the case to dump the
> entire value into the exception: it may be huge.

I agree. Default should be no dumping. I guess it's a very unlikey
case anyway, since when PG is handling it as JSON, it _is_ probably
a JSON ..



В списке psycopg по дате отправления:

Предыдущее
От: Tobias Oberstein
Дата:
Сообщение: Re: JSON type caster
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: Re: JSON type caster