本文整理匯總了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
# })