make value_in_json=True
This commit is contained in:
parent
1a76d2b5f3
commit
200a7672f2
4 changed files with 23 additions and 24 deletions
|
|
@ -168,6 +168,7 @@ class ProductOrderSchema(BaseSchema):
|
|||
def product_id_validation(self):
|
||||
product = resolve_product(self.product_id.value, etcd_client)
|
||||
if product:
|
||||
product['quantity'] = float(product['quantity'])
|
||||
self.product_id.value = product['uuid']
|
||||
self.objects['product'] = product
|
||||
logging.debug('Got product {}'.format(product))
|
||||
|
|
@ -181,7 +182,8 @@ class ProductOrderSchema(BaseSchema):
|
|||
raise ValidationException('No such product exists.')
|
||||
|
||||
def validation(self):
|
||||
customer_previous_orders = etcd_client.get_prefix('/v1/user/{}'.format(self.username.value), value_in_json=True)
|
||||
username = self.objects['user'].uid
|
||||
customer_previous_orders = etcd_client.get_prefix('/v1/user/{}'.format(username), value_in_json=True)
|
||||
customer_previous_orders = [o.value for o in customer_previous_orders]
|
||||
membership = next(filter(lambda o: o['product'] == 'membership', customer_previous_orders), None)
|
||||
if membership is None and self.objects['product']['usable-id'] != 'membership':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue