Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth_quick: error when there is no built_login in the database provided in request #326

Open
trojikman opened this issue Jul 18, 2021 · 0 comments

Comments

@trojikman
Copy link
Contributor

Steps to reproduce the error:

Let's say we run using this link: /auth_quick/login?build_login=admin
But we haven't such login as admin in the database.
After this code:

user = request.env["res.users"].sudo().search([("login", "=", build_login)])
build_user_id = user.id

we'll have this error:

ValueError
  
ValueError: invalid literal for int() with base 10: 'False'
Traceback (most recent call last)
    
  File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py",      line 142,      in application  
return application_unproxied(environ, start_response)
  File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py",      line 117,      in application_unproxied  
result = odoo.http.root(environ, start_response)
  File "/usr/lib/python3/dist-packages/odoo/http.py",      line 1281,      in __call__  
return self.dispatch(environ, start_response)
  File "/usr/lib/python3/dist-packages/odoo/http.py",      line 1251,      in __call__  
return self.app(environ, start_wrapped)
  File "/usr/lib/python3/dist-packages/werkzeug/middleware/shared_data.py",      line 220,      in __call__  
return self.app(environ, start_response)
  File "/usr/lib/python3/dist-packages/odoo/http.py",      line 1450,      in dispatch  
result = ir_http._dispatch()
  File "/usr/lib/python3/dist-packages/odoo/addons/website_sale/models/ir_http.py",      line 15,      in _dispatch  
return super(IrHttp, cls)._dispatch()
  File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_http.py",      line 172,      in _dispatch  
response = super(Http, cls)._dispatch()
  File "/usr/lib/python3/dist-packages/odoo/addons/auth_signup/models/ir_http.py",      line 19,      in _dispatch  
return super(Http, cls)._dispatch()
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_http.py",      line 22,      in _dispatch  
return super(IrHttp, cls)._dispatch()
  File "/usr/lib/python3/dist-packages/odoo/addons/utm/models/ir_http.py",      line 29,      in _dispatch  
response = super(IrHttp, cls)._dispatch()
  File "/usr/lib/python3/dist-packages/odoo/addons/http_routing/models/ir_http.py",      line 516,      in _dispatch  
result = super(IrHttp, cls)._dispatch()
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py",      line 233,      in _dispatch  
return cls._handle_exception(e)
  File "/usr/lib/python3/dist-packages/odoo/addons/utm/models/ir_http.py",      line 34,      in _handle_exception  
response = super(IrHttp, cls)._handle_exception(exc)
  File "/usr/lib/python3/dist-packages/odoo/addons/http_routing/models/ir_http.py",      line 607,      in _handle_exception  
return super(IrHttp, cls)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/addons/bae/models/ir_http.py",      line 198,      in _handle_exception  
raise exceptio
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py",      line 229,      in _dispatch  
result = request.dispatch()
  File "/usr/lib/python3/dist-packages/odoo/http.py",      line 803,      in dispatch  
r = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py",      line 345,      in _call_function  
return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py",      line 93,      in wrapper  
return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py",      line 338,      in checked_call  
result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py",      line 909,      in __call__  
return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py",      line 510,      in response_wrap  
response = f(*args, **kw)
  File "/mnt/addons/saas-addons/auth_quick_master/controllers/main.py",      line 21,      in get_token  
'build_user_id': build_user_id,
  File "<decorator-gen-123>",      line 2,      in create  
  File "/usr/lib/python3/dist-packages/odoo/api.py",      line 322,      in _model_create_single  
return create(self, arg)
  File "/mnt/addons/saas-addons/saas/models/auth_quick_master_token.py",      line 11,      in create  
res = super(Token, self).create(vals)
  File "<decorator-gen-3>",      line 2,      in create  
  File "/usr/lib/python3/dist-packages/odoo/api.py",      line 343,      in _model_create_multi  
return create(self, [arg])
  File "/usr/lib/python3/dist-packages/odoo/models.py",      line 3732,      in create  
records = self._create(data_list)
  File "/usr/lib/python3/dist-packages/odoo/models.py",      line 3804,      in _create  
col_val = field.convert_to_column(val, self, stored)
  File "/usr/lib/python3/dist-packages/odoo/fields.py",      line 1135,      in convert_to_column  
return int(value or 0)
  ValueError: invalid literal for int() with base 10: 'False'

Expected behavior:

Don't get such an error, but get a response that there is no such login

@trojikman trojikman changed the title auth_quick: error when build_login is other than admin auth_quick: error when there is no provided built_login in the database Jul 18, 2021
@trojikman trojikman changed the title auth_quick: error when there is no provided built_login in the database auth_quick: error when there is no built_login in the database provided in request Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant