From ebc010fd39507ff60d950e9866325d16c8e7fca2 Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Tue, 14 Aug 2012 13:55:55 +0200 Subject: [FIX] Fixed auth_oauth method bzr revid: vta@openerp.com-20120814115555-qyveeb9fibs598rh --- addons/auth_oauth/controllers/main.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'addons/auth_oauth/controllers/main.py') diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py index e0284638291..381602dff46 100644 --- a/addons/auth_oauth/controllers/main.py +++ b/addons/auth_oauth/controllers/main.py @@ -1,5 +1,4 @@ import logging -import urllib2 import werkzeug.urls import werkzeug.utils @@ -13,25 +12,30 @@ _logger = logging.getLogger(__name__) class OAuthController(openerpweb.Controller): _cp_path = '/auth_oauth' + def list_providers(self, req, dbname): + #dbname = kw.get("state") + #registry = openerp.modules.registry.RegistryManager.get(dbname) + #with registry.cursor() as cr: + # dsfasdf + pass + @openerpweb.httprequest def signin(self, req, **kw): dbname = kw.get("state") registry = openerp.modules.registry.RegistryManager.get(dbname) - cr = registry.db.cursor() - try: + with registry.cursor() as cr: try: u = registry.get('res.users') - r = u.auth_oauth(cr, 1, kw) + credentials = u.auth_oauth(cr, 1, kw) cr.commit() - return openerp.addons.web.controllers.main.login_and_redirect(req, *r) + return openerp.addons.web.controllers.main.login_and_redirect(req, *credentials) except AttributeError: # auth_signup is not installed url = "/#action=auth_signup&error=1" except Exception,e: # signup error url = "/#action=auth_signup&error=2" - finally: - cr.close() - return werkzeug.utils.redirect("https://localhost") + return werkzeug.utils.redirect("http://localhost:8069") + # vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: -- cgit v1.2.3