def __init__(self, *args, **kwargs):
        """
        Manage all field attributes
        """
        self.lockable = kwargs.get('lockable', True)
        if "default" in kwargs:
            self.default = kwargs["default"]

        self.indexable = kwargs.get("indexable", False)
        self.unique = kwargs.get("unique", False)
        if self.unique:
            if not self._unique_supported:
                raise ImplementationError('%s field cannot be unique' % self.__class__.__name__)
            if hasattr(self, "default"):
                raise ImplementationError('Cannot set "default" and "unique" together!')
            self.indexable = True

        self.index_classes = kwargs.get('indexes', [])
        if self.index_classes:
            if not self.indexable:
                raise ImplementationError('Cannot pass indexes if not indexable')

        # keep fields ordered
        self._creation_order = RedisField._creation_order
        RedisField._creation_order += 1
def __init__ ( self , * args , ** kwargs ) : self . lockable = kwargs . get ( 'lockable' , True ) if "default" in kwargs : self . default = kwargs [ "default" ] self . indexable = kwargs . get ( "indexable" , False ) self . unique = kwargs . get ( "unique" , False ) if self . unique : if not self . _unique_supported : raise ImplementationError ( '%s field cannot be unique' % self . __class__ . __name__ ) if hasattr ( self , "default" ) : raise ImplementationError ( 'Cannot set "default" and "unique" together!' ) self . indexable = True self . index_classes = kwargs . get ( 'indexes' , [ ] ) if self . index_classes : if not self . indexable : raise ImplementationError ( 'Cannot pass indexes if not indexable' ) self . _creation_order = RedisField . _creation_order RedisField . _creation_order += 1
Manage all field attributes