本文整理汇总了Python中openerp.http.route方法的典型用法代码示例。如果您正苦于以下问题:Python http.route方法的具体用法?Python http.route怎么用?Python http.route使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openerp.http
的用法示例。
在下文中一共展示了http.route方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: icalendar_freebusy
# 需要导入模块: from openerp import http [as 别名]
# 或者: from openerp.http import route [as 别名]
def icalendar_freebusy(self, partner=False, **post):
if partner:
#~ raise Warning("Public successfull %s" % partner.get_ics_calendar(type='public').to_ical())
#~ return partner.get_ics_calendar(type='public').to_ical()
document = partner.sudo().get_ics_calendar(type='freebusy').to_ical()
return request.make_response(
document,
headers=[
('Content-Disposition', 'attachment; filename="freebusy.ifb"'),
('Content-Type', 'text/calendar'),
('Content-Length', len(document)),
]
)
else:
raise Warning()
pass # Some error page
# @http.route(['/partner/<model("res.partner"):partner>/calendar/public.ics'], type='http', auth="public", website=True)
示例2: route
# 需要导入模块: from openerp import http [as 别名]
# 或者: from openerp.http import route [as 别名]
def route(self):
return request.render(
'ch14_r02_creating_or_modifying_templates.books',
{
'books': request.env['library.book'].search([]),
})
示例3: index
# 需要导入模块: from openerp import http [as 别名]
# 或者: from openerp.http import route [as 别名]
def index(self, **kw):
return "Hello, world"
# @http.route('/openacademy/openacademy/objects/', auth='public')
# def list(self, **kw):
# return http.request.render('openacademy.listing', {
# 'root': '/openacademy/openacademy',
# 'objects': http.request.env['openacademy.openacademy'].search([]),
# })
# @http.route('/openacademy/openacademy/objects/<model("openacademy.openacademy"):obj>/', auth='public')
# def object(self, obj, **kw):
# return http.request.render('openacademy.object', {
# 'object': obj
# })