def save(self): inputParams= self.getInput() try: Products.create( name = inputParams['name'], description = self.htmlunquote(inputParams['desc']), price1 = inputParams['price1'], price2 = inputParams['price2'], category = int(inputParams['category']), diameter = inputParams['diameter'], type = int(inputParams['type']), ) except Exception, e: return self.error(msg = '新增失败: %s' % e, url=self.makeUrl('/admin/products/list'))