more controller conversion to new route api

bzr revid: al@openerp.com-20131027173143-tfxc7e7vqn7re6wb
This commit is contained in:
Antony Lesuisse 2013-10-27 18:31:43 +01:00
parent 737586aa4e
commit d5b4cd627c
3 changed files with 9 additions and 14 deletions

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import simplejson
from openerp.addons.web.http import Controller, route
from openerp.http import Controller, route
class ImportController(Controller):
@route('/base_import/set_file')

View File

@ -4,14 +4,12 @@ from xml.etree import ElementTree
import openerp
from openerp.addons.web.controllers.main import load_actions_from_ir_values
class Board(openerp.addons.web.http.Controller):
_cp_path = '/board'
@openerp.addons.web.http.jsonrequest
def add_to_dashboard(self, req, menu_id, action_id, context_to_save, domain, view_mode, name=''):
class Board(openerp.http.Controller):
@openerp.http.route('/board/add_to_dashboard', type='json', auth='user')
def add_to_dashboard(self, menu_id, action_id, context_to_save, domain, view_mode, name=''):
req = openerp.http.request
# FIXME move this method to board.board model
dashboard_action = load_actions_from_ir_values(
req, 'action', 'tree_but_open', [('ir.ui.menu', menu_id)], False)
dashboard_action = load_actions_from_ir_values('action', 'tree_but_open', [('ir.ui.menu', menu_id)], False)
if dashboard_action:
action = dashboard_action[0][2]

View File

@ -26,13 +26,10 @@ from urlparse import urlparse, urlunparse
import openerp
from openerp.osv import fields, osv
class Binary(openerp.addons.web.http.Controller):
_cp_path = "/web_linkedin/binary"
@openerp.addons.web.http.jsonrequest
def url2binary(self, req, url):
class Binary(openerp.http.Controller):
@openerp.http.route('/web_linkedin/binary/url2binary', type='json', auth='user')
def url2binary(self, url):
"""Used exclusively to load images from LinkedIn profiles, must not be used for anything else."""
req.session.assert_valid(force=True)
_scheme, _netloc, path, params, query, fragment = urlparse(url)
# media.linkedin.com is the master domain for LinkedIn media (replicated to CDNs),
# so forcing it should always work and prevents abusing this method to load arbitrary URLs