當前位置: 首頁>>代碼示例>>Python>>正文


Python http.route方法代碼示例

本文整理匯總了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) 
開發者ID:vertelab,項目名稱:odoo-calendar,代碼行數:20,代碼來源:res_partner.py

示例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([]),
            }) 
開發者ID:PacktPublishing,項目名稱:Odoo-Development-Cookbook,代碼行數:8,代碼來源:main.py

示例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
#         }) 
開發者ID:n37r06u3,項目名稱:openacademy,代碼行數:17,代碼來源:controllers.py


注:本文中的openerp.http.route方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。