예제 #1
0
    def setUp(self):
        super(ProductTest, self).setUp()

        # Insert values into the db.
        p1 = product_db.Product(key_name='p1')
        p1.put()
        client_db.Client(key_name='c1', parent=p1, description='c1_desc').put()

        product_db.Product(key_name='p2').put()
예제 #2
0
파일: product.py 프로젝트: xincun/syzygy
  def post(self, product_id):
    """Creates a new product.

    /products/
      Creates a new product. The product ID should be specified in the body of
      the request.
    /products/<product>
      Unused.

    Args:
      product_id: The product ID. Must be empty.
    """
    # Validate input.
    if product_id:
      self.error(httplib.BAD_REQUEST)
      return

    product_id = self.request.get('product_id')
    if not product_id:
      self.error(httplib.BAD_REQUEST)
      return

    # Perform DB lookups.
    # Make sure that this product ID does not already exist.
    if product_db.Product.get_by_key_name(product_id):
      self.error(httplib.BAD_REQUEST)
      return

    # Create a new product.
    product = product_db.Product(key_name=product_id)
    product.put()
    self.response.set_status(httplib.CREATED, message='ProductCreated')
예제 #3
0
파일: datum_test.py 프로젝트: xincun/syzygy
    def setUp(self):
        super(
            DatumTest,
            self,
        ).setUp()

        # Insert values into the db.
        p1 = product_db.Product(key_name='p1')
        p1.put()

        c1 = client_db.Client(key_name='c1', parent=p1, description='c1_desc')
        c1.put()

        m1 = metric_db.Metric(key_name='m1',
                              parent=c1,
                              description='m1_desc',
                              units='stones')
        m1.put()

        self._d1 = datum_db.Datum(parent=m1,
                                  product_version='d1_prod_ver',
                                  toolchain_version='d1_tool_ver',
                                  values=[1.0, 2.0])
        self._d1.put()

        self._d2 = datum_db.Datum(parent=m1,
                                  product_version='d2_prod_ver',
                                  toolchain_version='d2_tool_ver',
                                  values=[3.0, 4.0])
        self._d2.put()
예제 #4
0
def customize():
    pid = request.args['product_id']
    most_useful = support_recommend.support_recommendation(pid)
    single_product = product.Product().select_product(pid)
    service_list = services.Service().view_service()
    return render_template('customize.html',
                           record=single_product,
                           service_list=service_list,
                           most_useful=most_useful)
예제 #5
0
def warranty():
    pid = request.args['product_id']
    sid = request.args['service_id']
    seek_support.seeking_for_support(pid, sid)
    single_product = product.Product().select_product(pid)
    service_list = services.Service().view_service()
    return render_template('warranty.html',
                           record=single_product,
                           service_list=service_list)
예제 #6
0
def go_to_support():
    uid = 1
    order_list = order.Order().show_order(uid)
    prod_list = []
    for item in order_list:
        prod_id = item[2]
        prod_list.append(product.Product().select_product(prod_id))
    prod_order_list = zip(order_list, prod_list)
    return render_template('support.html', prod_order_list=prod_order_list)
예제 #7
0
def add_to_cart():
    service_id = request.form['sid']
    pid = request.form['pid']
    scart.append(service_id)
    pcart.append(pid)
    single_product = product.Product().select_product(pid)
    service_list = services.Service().view_service()
    return render_template('customize.html',
                           record=single_product,
                           service_list=service_list)
예제 #8
0
def go_to_cart():
    prod_list = []
    serv_list = []
    for item in pcart:
        single_product = product.Product().select_product(item)
        prod_list.append(single_product)

    for item in scart:
        single_service = services.Service().select_service(item)
        serv_list.append(single_service)

    prod_serv_list = zip(prod_list, serv_list)

    return render_template('cart.html', prod_serv_list=prod_serv_list)
예제 #9
0
    def setUp(self):
        super(MetricTest, self).setUp()

        # Insert values into the db.
        p1 = product_db.Product(key_name='p1')
        p1.put()

        c1 = client_db.Client(key_name='c1', parent=p1, description='c1_desc')
        c1.put()

        m1 = metric_db.Metric(key_name='m1',
                              parent=c1,
                              description='m1_desc',
                              units='stones')
        m1.put()
        m2 = metric_db.Metric(key_name='m2',
                              parent=c1,
                              description='m2_desc',
                              units='furlongs')
        m2.put()
예제 #10
0
def go_to_view_products():
    product_list = product.Product().view_product()
    return render_template('products.html',
                           product_list=product_list,
                           product_count=len(product_list))