示例#1
0
 def _fetchComplementingCarts(self, cart_ids):
   """
   Fetches complementing carts to given cart_ids related to all carts in DB.
   """
   carts = [self._fetchCart(cart_id) for cart_id in cart_ids]
   all_carts = Cart.objects()
   return [cart for cart in all_carts if cart not in carts]
示例#2
0
 def _fetchComplementingCarts(self, cart_ids):
     """
 Fetches complementing carts to given cart_ids related to all carts in DB.
 """
     carts = [self._fetchCart(cart_id) for cart_id in cart_ids]
     all_carts = Cart.objects()
     return [cart for cart in all_carts if cart not in carts]
示例#3
0
 def _fetchCart(self, cart_id):
   """
   Fetches cart by given ID.
   """
   try:
     return Cart.objects(cart_id=cart_id).get()
   except:
     return None
示例#4
0
文件: user.py 项目: hochbergg/cartman
 def _fetchCart(self, cart_id):
   """
   Fetches cart by given ID.
   """
   try:
     return Cart.objects(cart_id=str(cart_id)).get()
   except:
     return None
示例#5
0
    def put(self, cart_id: str) -> Response:
        """
        PUT response method for updating a product.
        JSON Web Token is required.
        Authorization is required: Access(admin=true)

        :return: JSON object
        """
        data = request.get_json()
        print('cartupdate')
        print(data)
        y = json.loads(data['products'])
        print(y)
        hh = {'products': y}
        put_user = Cart.objects(id=cart_id).update(**hh)  #**data
        return jsonify({'result': put_user})
示例#6
0
def current_state_of_carts():
    carts = Cart.objects()
    return jsonify(title='As of {}'.format(datetime.now()),
                   msg=[cart.toMinimalJson() for cart in carts])
示例#7
0
def current_state_of_carts():
    carts = Cart.objects()
    return jsonify(title='As of {}'.format(datetime.now()),
                   msg=[cart.toMinimalJson() for cart in carts])