本文整理汇总了Python中models.package.Package.getPackageByName方法的典型用法代码示例。如果您正苦于以下问题:Python Package.getPackageByName方法的具体用法?Python Package.getPackageByName怎么用?Python Package.getPackageByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.package.Package
的用法示例。
在下文中一共展示了Package.getPackageByName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: job_package
# 需要导入模块: from models.package import Package [as 别名]
# 或者: from models.package.Package import getPackageByName [as 别名]
def job_package():
# Log.info("请异步发送")
need_do = ''
orders = Order.get_working_orders()
for order in orders:
product = Product.lookup(order['p_id'])
exchange = Exchange.get_exchange(order['e_id'])
packages = Package.getPackageByName(order['package_id'])
for package in packages:
need_do = need_do+json.dumps({'port':product['port'],'bandwidth':order['bandwidth'],\
'status':order['status'],'port_name':product['port'], 'ipAddress':exchange['ipAddress'], \
'package_id':package['package_name']})
# Order.finish_order(order['_id'])
need_back=''
orders = Order.get_back_orders()
for order in orders:
custom_time = order['custom_time']
product = Product.lookup(order['p_id'])
exchange = Exchange.look(order['e_id'])
packages = Package.getPackageByName(order['package_id'])
for package in packages:
need_back = need_back+json.dumps({'port':product['port'],'ex_bandwidth':order['bandwidth'],\
'status':order['status'],'port_name':product['port'], 'ipAddress':exchange['ipAddress'], \
'package_id':package['package_name']})
# Order.back_order(order['_id'])
print 'set_package_job end at ',datetime.datetime.now()
示例2: post
# 需要导入模块: from models.package import Package [as 别名]
# 或者: from models.package.Package import getPackageByName [as 别名]
def post(self):
package_name = self.get_argument("package_name", None)
status = self.get_argument("status", None)
page = self.get_argument('page', 1)
page = page if page >= 1 else 1
count = self.get_argument('count', 10)
count = count if count >= 1 else 10
template_values = {}
if package_name is not None:
if status is not None and status != '':
packages = Package.getPackageByCondition(package_name, int(status))
template_values['status'] = int(status)
else:
print package_name
packages = Package.getPackageByName(package_name)
print packages
template_values['status'] = ''
else:
if status is not None and status != '':
packages = Package.getPackageByStatus(int(status))
template_values['status'] = int(status)
else:
packages = Package.getallPackages()
template_values['status'] = ''
#create a Paginator object
paginator = Paginator(packages, page, count, len(packages))
template_values['_id'] = package_name
template_values['paginator'] = paginator
self.render_template('/site/searchPackage.html', **template_values)
示例3: get
# 需要导入模块: from models.package import Package [as 别名]
# 或者: from models.package.Package import getPackageByName [as 别名]
def get(self):
package_name = self.get_argument('package_name')
package = Package.getPackageByName(package_name)
page = self.get_argument('page', 1)
page = page if page >= 1 else 1
#get the document count param
count = self.get_argument('count', 10)
count = count if count >= 1 else 10
paginator = Paginator(package, page, count, len(package))
template_values = {}
template_values['paginator'] = paginator
template_values['next'] = self.get_argument('next','/')
self.render_template('/site/updatePackage.html',**template_values)