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


Python Order.get_by_id方法代码示例

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


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

示例1: getLogItem

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import get_by_id [as 别名]
def getLogItem(action, request, session):
    """
        Get Log item from DB by selected log item's ID.

        Arguments:
            action  - 302|303|304|307
            request - form (selected_item)
            session - current session

        Returns:
            exchange_error, exchange_message - exchange error info
            id      - parsed ID of selected_item
            data    - XML (Order.data)
    """
    form = request.form

    print_action(action, 'DBase.GetLogItem')

    exchange_message = ''
    exchange_error = 0
    order = None

    id = form.get('selected_item', None)

    if IsDebug:
        print '>>> Selected LogItem ID: [%s]' % id

    if id:
        order = Order.get_by_id(id)
    else:
        exchange_message = '%s: <id>' % gettext('Missing argument')
        exchange_error = -10

    return (exchange_error, exchange_message, id, order)
开发者ID:ichar,项目名称:player.python,代码行数:36,代码来源:dbase.py

示例2: get

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import get_by_id [as 别名]
 def get(self, id):
     order = Order.get_by_id(id)
     if order is None:
         self.error(404)
     purchases = order.get_purchases()
     self.generate('purchase_in_order.html',
                   {'order':order,
                    'purchases':purchases})
开发者ID:tchaikov,项目名称:beanfs,代码行数:10,代码来源:order.py

示例3: getStatictics

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import get_by_id [as 别名]
def getStatictics(action, request, session):
    """
        Get Price items from DB by selected log item's ID.

        Arguments:
            action  - 305
            request - form (selected_item)
            session - current session

        Returns:
            exchange_error, exchange_message - exchange error info
            id      - parsed ID of selected_item
            data    - XML (Order.data)
    """
    form = request.form

    print_action(action, 'DBase.GetLogStatistics')

    exchange_message = ''
    exchange_error = 0
    response = None
    order = None

    id = form.get('selected_item', None)

    if IsDebug:
        print '>>> Selected LogItem ID: [%s]' % id

    if id:
        order = Order.get_by_id(id)
    else:
        exchange_message = '%s: <id>' % gettext('Missing argument')
        exchange_error = -10

    total, order_id, data, query = statistics(DEFAULT_LOG_MODE, order=order)

    items = []
    headers = get_statistics_headers()
    line_in_page = 0

    for row in data:
        x = dict(zip(headers[0], row))
        line_in_page += 1

        x['root'] = '%s' % request.script_root
        x['num'] = line_in_page
        x['cdate'] = cdate(x['reg_date'], fmt=LOCAL_EASY_TIMESTAMP)

        for n, column in enumerate(headers[1]):
            x['%s_title' % column['id']] = column['title']

        items.append([x['id'], [ column.has_key('value') and (column['value'] % x) or x[column['id']]
            for n, column in enumerate(headers[1])
                if column.get('visible') ]
        ])

    return (exchange_error, exchange_message, id, total, items)
开发者ID:ichar,项目名称:player.python,代码行数:59,代码来源:dbase.py

示例4: get_order

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import get_by_id [as 别名]
def get_order(id=None, code=None, **kw):
    order = None
    if id:
        order = Order.get_by_id(id)
    elif code:
        user = kw.get('user')
        module = kw.get('module')
        if user and module:
            order = Order.query.filter_by(user=user, module=module, code=code).first()
    return order    
开发者ID:ichar,项目名称:player.python,代码行数:12,代码来源:dbase.py

示例5: post

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import get_by_id [as 别名]
 def post(self, order_id):
   order = Order.get_by_id(long(order_id))
   if order is None:
     self.error(404)
     return
   # TODO: `purchaese' should be the received json object
   purchases = order.get_purchases()
   balance = UserBalance()
   for p in purchases:
     balance.pay_for(p.customer, p.item.price)
   self.redirect('/u/mine/profile')
开发者ID:tchaikov,项目名称:beanfs,代码行数:13,代码来源:order.py


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