# Path: lighty/db/functor.py
# class BaseField(functor.BaseFunctor):
#     '''Base field class
#     '''
#     # Declare lazy operations
#     _lazy = (operator.__lt__, operator.__gt__, operator.__le__,
#              operator.__ge__, operator.__eq__, operator.__ne__,
#              operator.__add__, )
# 
#     def __init__(self):
#         super(BaseField, self).__init__()
# 
#     def create_copy(self, operation, operand):
#         return FieldFunctor(self, operation, operand)
# 
# class NumericField(BaseField):
#     '''Base class for any numerical fields. It can be used to create:
# 
#         integers
#         floats
#         decimals
#     '''
#     _lazy = (operator.__sub__, operator.__mul__, operator.__truediv__,
#              operator.__floordiv__, operator.__mod__, operator.__pow__, )
# 
# class SequenceField(BaseField):
#     '''Class used for sequences fields creations. It can be used to create:
# 
#         strings
#         arrays
#         dictionaries
#     '''
#     _lazy = (operator.__getitem__, operator.__contains__, )
# 
#     def contains(self, operand):
#         '''Check is object contains
#         '''
#         return self.create_copy(operator.__contains__, operand)
# 
#     def __len__(self):
#         return 'len'


import lighty.validators
        import datetime
from .functor import BaseField, NumericField, SequenceField
        from ..utils import string_types
        from ..utils import string_types
            from datetime import datetime
        from time import gmtime
    def get_value_for_datastore(self, model):
        '''Prepare value to store it into datastore.

        Returns:
            string represents field value in format "%Y-%m-%d %H:%M:%S"
        '''
        if self.auto_now or (self.auto_now_add and not model.is_saved()):
            setattr(model, self.name, datetime.now())
        return Field.get_value_for_datastore(self, model)

    def make_value_from_datastore(self, value):
        return value


class TimeField(DateField, NumericField):
    '''A time, represented in Python by a datetime.time instance. Accepts the
    same auto-population options as DateField.
    '''

    def get_value_for_datastore(self, model):
        '''Prepare value to store it into datastore.

        Returns:
            string represents field value in format "%Y-%m-%d %H:%M:%S"
        '''
        if self.auto_now or (self.auto_now_add and not model.is_saved()):
            setattr(model, self.name, gmtime())
        return super(DateField, self).get_value_for_datastore(model)



# Path: lighty/db/functor.py
# class BaseField(functor.BaseFunctor):
#     '''Base field class
#     '''
#     # Declare lazy operations
#     _lazy = (operator.__lt__, operator.__gt__, operator.__le__,
#              operator.__ge__, operator.__eq__, operator.__ne__,
#              operator.__add__, )
# 
#     def __init__(self):
#         super(BaseField, self).__init__()
# 
#     def create_copy(self, operation, operand):
#         return FieldFunctor(self, operation, operand)
# 
# class NumericField(BaseField):
#     '''Base class for any numerical fields. It can be used to create:
# 
#         integers
#         floats
#         decimals
#     '''
#     _lazy = (operator.__sub__, operator.__mul__, operator.__truediv__,
#              operator.__floordiv__, operator.__mod__, operator.__pow__, )
# 
# class SequenceField(BaseField):
#     '''Class used for sequences fields creations. It can be used to create:
# 
#         strings
#         arrays
#         dictionaries
#     '''
#     _lazy = (operator.__getitem__, operator.__contains__, )
# 
#     def contains(self, operand):
#         '''Check is object contains
#         '''
#         return self.create_copy(operator.__contains__, operand)
# 
#     def __len__(self):
#         return 'len'


# Path: lighty/db/fields.py
import lighty.validators
        import datetime
from .functor import BaseField, NumericField, SequenceField
        from ..utils import string_types
        from ..utils import string_types
            from datetime import datetime
        from time import gmtime

    def get_value_for_datastore(self, model):
        '''Prepare value to store it into datastore.

        Returns:
            string represents field value in format "%Y-%m-%d %H:%M:%S"
        '''
        if self.auto_now or (self.auto_now_add and not model.is_saved()):
            setattr(model, self.name, datetime.now())
        return Field.get_value_for_datastore(self, model)

    def make_value_from_datastore(self, value):
        return value


class TimeField(DateField, NumericField):
    '''A time, represented in Python by a datetime.time instance. Accepts the
    same auto-population options as DateField.
    '''

    def get_value_for_datastore(self, model):
        '''Prepare value to store it into datastore.

        Returns:
            string represents field value in format "%Y-%m-%d %H:%M:%S"
        '''
        if self.auto_now or (self.auto_now_add and not model.is_saved()):
            setattr(model, self.name, gmtime())
        return super(DateField, self).get_value_for_datastore(model)



class TextField(Field, SequenceField):