Exemplo n.º 1
0
	def query(self, params):
		q = Structs.getQueryFromXmlRpc(params[0])
		ptype = Structs.getProductTypeFromXmlRpc(params[1])
		ids = self.catalog.query(q, ptype)
		if ids is not None and len(ids) > 0:
			return Result(None, [self.catalog.getProductById(i) for i in ids])
		return Result(None, Vector())
Exemplo n.º 2
0
	def getProductsByProductType(self, params):
		ptype = Structs.getProductTypeFromXmlRpc(params[0])
		return Result(None, Structs.getXmlRpcProductList(self.catalog.getProductsByProductType(ptype)))
Exemplo n.º 3
0
	def getElementsByProductType(self, params):
		ptype = Structs.getProductTypeFromXmlRpc(params[0])
		return Structs.getXmlRpcElementList(self.catalog.getValidationLayer().getElements(ptype))
Exemplo n.º 4
0
	def getTopNProducts(self, params):
		if len(params) == 1:
			return Result(None, Structs.getXmlRpcProductList(self.catalog.getTopNProducts(params[0])))
		ptype = Structs.getProductTypeFromXmlRpc(params[1])
		return Result(None, Structs.getXmlRpcProductList(self.catalog.getTopNProducts(params[0], ptype)))
Exemplo n.º 5
0
	def getNumProducts(self, params):
		ptype = Structs.getProductTypeFromXmlRpc(params[0])
		return Result(Integer, str(self.catalog.getNumProducts(ptype)))
Exemplo n.º 6
0
	def addProductType(self, params):
		ptype = Structs.getProductTypeFromXmlRpc(params[0])
		self.repo.addProductType(ptype)
		return Result(None, ptype.getProductTypeId())
Exemplo n.º 7
0
	def getPrevPage(self, params):
		ptype = Structs.getProductTypeFromXmlRpc(params[0])
		page = Structs.getProductPageFromXmlRpc(params[1])
		return Result(None, Structs.getXmlRpcProductPage(self.catalog.getPrevPage(ptype, page)))
Exemplo n.º 8
0
	def pagedQuery(self, params):
		ptype = Structs.getProductTypeFromXmlRpc(params[1])
		query = Structs.getQueryFromXmlRpc(params[0])
		return Result(None, Structs.getXmlRpcProductPage(self.catalog.pagedQuery(query, ptype, params[2])))