示例#1
0
def set_export_formatters():
    """
    Globally set export formatters in the sqla_inspect registry
    """
    from sqla_inspect.export import FORMATTERS_REGISTRY
    from autonomie.views import render_api
    from autonomie.export.utils import format_boolean

    FORMATTERS_REGISTRY.add_formatter(Date, render_api.format_date, 'py3o')
    FORMATTERS_REGISTRY.add_formatter(DateTime, render_api.format_datetime,
                                      'py3o')
    FORMATTERS_REGISTRY.add_formatter(Boolean, format_boolean)
    FORMATTERS_REGISTRY.add_formatter(Float, render_api.format_quantity)
    FORMATTERS_REGISTRY.add_formatter(Integer, render_api.format_quantity)
示例#2
0
def set_export_formatters():
    """
    Globally set export formatters in the sqla_inspect registry
    """
    from sqla_inspect.export import FORMATTERS_REGISTRY
    from autonomie.views import render_api
    from autonomie.export.utils import format_boolean

    FORMATTERS_REGISTRY.add_formatter(
        Date, render_api.format_date, 'py3o'
    )
    FORMATTERS_REGISTRY.add_formatter(
        DateTime, render_api.format_datetime, 'py3o'
    )
    FORMATTERS_REGISTRY.add_formatter(Boolean, format_boolean)
    FORMATTERS_REGISTRY.add_formatter(Float, render_api.format_quantity)
    FORMATTERS_REGISTRY.add_formatter(Integer, render_api.format_quantity)
示例#3
0
def set_export_formatters():
    """
    Globally set export formatters in the sqla_inspect registry
    """
    from sqla_inspect.export import FORMATTERS_REGISTRY
    from sqlalchemy import (
        Boolean,
        Date,
        DateTime,
    )
    from autonomie.views import render_api
    from autonomie.export.utils import format_boolean
    FORMATTERS_REGISTRY.add_formatter(Date, render_api.format_date)
    FORMATTERS_REGISTRY.add_formatter(DateTime, render_api.format_datetime)
    FORMATTERS_REGISTRY.add_formatter(Boolean, format_boolean)
示例#4
0
def set_export_formatters():
    """
    Globally set export formatters in the sqla_inspect registry
    """
    from sqla_inspect.export import FORMATTERS_REGISTRY
    from sqlalchemy import (
        Boolean,
        Date,
        DateTime,
    )
    from autonomie.views import render_api
    from autonomie.export.utils import format_boolean
    FORMATTERS_REGISTRY.add_formatter(Date, render_api.format_date)
    FORMATTERS_REGISTRY.add_formatter(DateTime, render_api.format_datetime)
    FORMATTERS_REGISTRY.add_formatter(Boolean, format_boolean)
示例#5
0
def set_export_formatters():
    """
    Globally set export formatters in the sqla_inspect registry
    """
    from sqla_inspect.export import FORMATTERS_REGISTRY
    from autonomie_base.utils.date import (
        format_date,
        format_datetime,
    )
    from autonomie_base.utils.strings import (
        format_quantity, )
    from autonomie_base.utils.export import format_boolean

    FORMATTERS_REGISTRY.add_formatter(Date, format_date, 'py3o')
    FORMATTERS_REGISTRY.add_formatter(DateTime, format_datetime, 'py3o')
    FORMATTERS_REGISTRY.add_formatter(Date, format_date, 'csv')
    FORMATTERS_REGISTRY.add_formatter(DateTime, format_date, 'csv')
    FORMATTERS_REGISTRY.add_formatter(Boolean, format_boolean)
    FORMATTERS_REGISTRY.add_formatter(Float, format_quantity)
    FORMATTERS_REGISTRY.add_formatter(Integer, format_quantity)