diff options
| author | vta vta@openerp.com <> | 2012-08-14 13:55:55 +0200 |
|---|---|---|
| committer | vta vta@openerp.com <> | 2012-08-14 13:55:55 +0200 |
| commit | ebc010fd39507ff60d950e9866325d16c8e7fca2 (patch) | |
| tree | c753e81dbbab179916ea75cc870d0e7b8a37f9e9 /addons/auth_oauth/controllers/main.py | |
| parent | b1e5c9e1ae1b997a44d2c273768cee4a41909b93 (diff) | |
[FIX] Fixed auth_oauth method
bzr revid: vta@openerp.com-20120814115555-qyveeb9fibs598rh
Diffstat (limited to 'addons/auth_oauth/controllers/main.py')
| -rw-r--r-- | addons/auth_oauth/controllers/main.py | 20 |
1 files changed, 12 insertions, 8 deletions
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: |
