'''
Created on Jul 19, 2011

@author: Pravin
'''
import sqlalchemy.types as types
from orangescape.model.server.util import ConversionUtil

class EngineDateType(types.TypeDecorator):
    impl = types.DateTime

    def process_bind_param(self, value, dialect):
        if value is not None:
            return str(ConversionUtil.convert_date_xl_to_py(value))
        return None

    def process_result_value(self, value, dialect):
        if value is not None:
            return ConversionUtil.convert_date_py_to_xl(value)
        return None