コード例 #1
0
	def __init__(self, val=None, mdl=None):
		'''
			__init__ - Create this object

			@param val - None for empty list, IndexedRedisModel for a one-item list, or a list/tuple or subclass of initial values.
			@param mdl - The IndexedRedisModel that this list will contain. Provide this now if you can, otherwise it will be inferred from
			  the first item added or present in the list.

			@raises ValueError if "mdl" is not an IndexedRedisModel
		'''
		if val is None:
			QueryableListObjs.__init__(self)
		else:
			QueryableListObjs.__init__(self, val)


		self.mdl = mdl

		if not mdl:
			# If not explicitly defined, try to infer model if objects were provided.
			#  otherwise, inference will be attempted when an operation that requires it is performed.
			self.mdl = self.getModel()
		else:
			# This is called in getModel() if we did infer, so no need to call twice.
			self.__validate_model(mdl)
コード例 #2
0
    def __init__(self, val=None, mdl=None):
        '''
			__init__ - Create this object

			@param val - None for empty list, IndexedRedisModel for a one-item list, or a list/tuple or subclass of initial values.
			@param mdl - The IndexedRedisModel that this list will contain. Provide this now if you can, otherwise it will be inferred from
			  the first item added or present in the list.

			@raises ValueError if "mdl" is not an IndexedRedisModel
		'''
        if val is None:
            QueryableListObjs.__init__(self)
        else:
            QueryableListObjs.__init__(self, val)

        self.mdl = mdl

        if not mdl:
            # If not explicitly defined, try to infer model if objects were provided.
            #  otherwise, inference will be attempted when an operation that requires it is performed.
            self.mdl = self.getModel()
        else:
            # This is called in getModel() if we did infer, so no need to call twice.
            self.__validate_model(mdl)