当前位置: 首页>>代码示例>>Python>>正文


Python Product.id方法代码示例

本文整理汇总了Python中product.Product.id方法的典型用法代码示例。如果您正苦于以下问题:Python Product.id方法的具体用法?Python Product.id怎么用?Python Product.id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在product.Product的用法示例。


在下文中一共展示了Product.id方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: manage_beverages_edit

# 需要导入模块: from product import Product [as 别名]
# 或者: from product.Product import id [as 别名]
def manage_beverages_edit(name=None):
    if request.method == 'GET':
        error = None
        p = get_product_by_name(name)

        if p is None:
            error = "Product existiert nicht"

        return render_template('manage_beverages_edit.html', product_to_edit=p, error=error, user=get_user_by_name(session.get('name')))

    if request.method == 'POST':
        p = Product()
        #print request.form
        p.id = request.form['id']
        p.name = request.form['name']
        p.price = float(request.form['price'])

        if 'isshown' in request.form:
            p.isshown = True
        else:
            p.isshown = False

        pic = request.files['file']
        if pic:
            extension = pic.filename.rsplit('.', 1)[1].lower()
            if extension == "png" or extension == "jpg":
                pic.seek(0) # Move cursor back to beginning so we can write to disk
                fpath = os.path.join("./app/static/", "product_%s.png" % p.name)
                pic.save(fpath)

        update_product(p)

        # update_user(u)

        return redirect('/manage_beverages')
开发者ID:ulrichknecht,项目名称:baroness,代码行数:37,代码来源:views.py

示例2: get_product_by_name

# 需要导入模块: from product import Product [as 别名]
# 或者: from product.Product import id [as 别名]
def get_product_by_name(name):
    row = query_db("SELECT * FROM PRODUCTS WHERE NAME = ?", [str(name)], one=True)
    p = Product()
    p.id = row[0]
    p.name = row[1]
    p.price = row[2]
    p.isshown = row[3]
    return p
开发者ID:ulrichknecht,项目名称:baroness,代码行数:10,代码来源:database.py

示例3: get_product_by_id

# 需要导入模块: from product import Product [as 别名]
# 或者: from product.Product import id [as 别名]
def get_product_by_id(id):
    row = query_db("SELECT * FROM PRODUCTS WHERE ID = ?", [str(id)], one=True)
#    print row
    p = Product()
    p.id = row[0]
    p.name = row[1]
    p.price = row[2]
    p.isshown = row[3]
    return p
开发者ID:ulrichknecht,项目名称:baroness,代码行数:11,代码来源:database.py

示例4: get_products

# 需要导入模块: from product import Product [as 别名]
# 或者: from product.Product import id [as 别名]
def get_products():
    rows = query_db("SELECT * FROM PRODUCTS")
    products = []
    for row in rows:
        p = Product()
        p.id = row[0]
        p.name = row[1]
        p.price = row[2]
        p.isshown = row[3]
        products.append(p)
    return products
开发者ID:ulrichknecht,项目名称:baroness,代码行数:13,代码来源:database.py

示例5: ProductRatePlan

# 需要导入模块: from product import Product [as 别名]
# 或者: from product.Product import id [as 别名]
from platin.core.date import Date
from zuoraobject import ZuoraObject

class ProductRatePlan(ZuoraObject):
    class_name = 'ProductRatePlan'
    
if __name__=="__main__":
    from product import Product
    from zuora.client import Zuora
    client = Zuora()
    p = Product('Auto - test')
    p.create(client)
    pr = ProductRatePlan('Product Rate 1',ProductId=p.id())
    pr.create(client)
开发者ID:legibe,项目名称:platin,代码行数:16,代码来源:productrateplan.py

示例6: __init__

# 需要导入模块: from product import Product [as 别名]
# 或者: from product.Product import id [as 别名]
    class_name = 'ProductRatePlanCharge'

    def __init__(self,name,*args,**kwargs):
        if not 'ChargeModel' in kwargs:
            kwargs['ChargeModel'] = 'Flat Fee Pricing'
        self._tiers = args
        super(FlatFeePricing,self).__init__(name,**kwargs)

    def create(self,client):
        p = super(FlatFeePricing,self).create(client)
        for tier in self._tiers:
            charge = ProductRateChargeTier(None,PriceFormat = 'FlatFee',**tier)
            p.ProductRatePlanChargeTierData.ProductRatePlanChargeTier.append(charge.create(client))

if __name__=="__main__":
    from product import Product
    from productrateplan import ProductRatePlan
    from zuora.client import Zuora
    client = Zuora()

    p = Product('Auto - test')
    p.createAndSend(client)
    pr = ProductRatePlan('Product Rate 1',id = p.id())
    pr.createAndSend(client)
    entries = [
        dict(Price=3000,Currency='USD'),
        dict(Price=2000,Currency='EUR')
    ]
    ff = FlatFeePricing('sub',*entries,id=pr.id(),ChargeType="Recurring")
    ff.createAndSend(client)
开发者ID:legibe,项目名称:platin,代码行数:32,代码来源:flatfeepricing.py


注:本文中的product.Product.id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。