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 -*- # -*- coding: utf-8 -*-
import simplejson import simplejson
from openerp.addons.web.http import Controller, route from openerp.http import Controller, route
class ImportController(Controller): class ImportController(Controller):
@route('/base_import/set_file') @route('/base_import/set_file')

View File

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

View File

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