diff options
Diffstat (limited to 'addons/auth_oauth/controllers/main.py')
| -rw-r--r-- | addons/auth_oauth/controllers/main.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py index ae01df5f6f7..26016f3f0a1 100644 --- a/addons/auth_oauth/controllers/main.py +++ b/addons/auth_oauth/controllers/main.py @@ -4,28 +4,25 @@ import simplejson import werkzeug.urls import werkzeug.utils -import openerp.modules.registry -import openerp.addons.web.controllers.main -import openerp.addons.web.common.http as openerpweb -from openerp import SUPERUSER_ID +import openerp _logger = logging.getLogger(__name__) -class OAuthController(openerpweb.Controller): +class OAuthController(openerp.addons.web.http.Controller): _cp_path = '/auth_oauth' - @openerpweb.jsonrequest + @openerp.addons.web.http.jsonrequest def list_providers(self, req, dbname): try: registry = openerp.modules.registry.RegistryManager.get(dbname) with registry.cursor() as cr: providers = registry.get('auth.oauth.provider') - l = providers.read(cr, SUPERUSER_ID, providers.search(cr, SUPERUSER_ID, [('enabled','=',True)])) + l = providers.read(cr, openerp.SUPERUSER_ID, providers.search(cr, openerp.SUPERUSER_ID, [('enabled','=',True)])) except Exception: l = [] return l - @openerpweb.httprequest + @openerp.addons.web.http.httprequest def signin(self, req, **kw): state = simplejson.loads(kw['state']) dbname = state['d'] @@ -34,7 +31,7 @@ class OAuthController(openerpweb.Controller): with registry.cursor() as cr: try: u = registry.get('res.users') - credentials = u.auth_oauth(cr, SUPERUSER_ID, provider, kw) + credentials = u.auth_oauth(cr, openerp.SUPERUSER_ID, provider, kw) cr.commit() return openerp.addons.web.controllers.main.login_and_redirect(req, *credentials) except AttributeError: @@ -43,7 +40,7 @@ class OAuthController(openerpweb.Controller): url = "/#action=login&oauth_error=1" except Exception,e: # signup error - _logger.exception('oops') + _logger.exception("OAuth2: %s" % str(e)) url = "/#action=login&oauth_error=2" return openerp.addons.web.controllers.main.set_cookie_and_redirect(req, url) |
