SP/web2py/gluon/packages/dal/pydal/parsers/postgre.py

37 lines
793 B
Python
Raw Permalink Normal View History

2018-10-25 15:33:07 +00:00
from ..adapters.postgres import Postgre, PostgreNew, PostgreBoolean
from .base import BasicParser, ListsParser, JSONParser
from . import parsers, for_type
@parsers.register_for(Postgre)
class PostgreParser(ListsParser, JSONParser):
@for_type('jsonb')
def _jsonb(self, value):
return self.json(value)
class PostgreAutoJSONParser(ListsParser):
pass
@parsers.register_for(PostgreNew)
class PostgreNewParser(JSONParser):
pass
class PostgreNewAutoJSONParser(BasicParser):
pass
@parsers.register_for(PostgreBoolean)
class PostgreBooleanParser(JSONParser):
@for_type('boolean')
def _boolean(self, value):
return value
class PostgreBooleanAutoJSONParser(BasicParser):
@for_type('boolean')
def _boolean(self, value):
return value