Tryton - Issues

 

Issue8319

Title Reset password and Validate e-mail doesn't work on web_user module
Priority bug Status testing
Superseder Nosy List ced, iehoshia, pokoli, reviewbot
Type crash Components web_user
Assigned To pokoli Keywords review
Reviews 275351002
View: 275351002

Created on 2019-04-29.20:44:49 by iehoshia, last changed by ced.

Messages
msg49769 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-05-20.12:07:15
By having a default url, I mean an actual working default url not an empty string.
review275351002 updated at https://codereview.tryton.org/275351002/#ps271421003
review275351002 updated at https://codereview.tryton.org/275351002/#ps285211002
msg49263 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-04-30.23:59:07
As the problem comes because the urls are not configured. Will it not be better to define always a default url?
review275351002 updated at https://codereview.tryton.org/275351002/#ps283311002
msg49251 (view) Author: [hidden] (pokoli) (Tryton committer) Date: 2019-04-30.11:41:32
The problem is because urllib.parse.urlsplit returns bytes when using None as URL:

See:

>>> import urllib.parse
>>> urllib.parse.urlsplit(None)
SplitResultBytes(scheme=b'', netloc=b'', path=b'', query=b'', fragment=b'')
>>> urllib.parse.urlsplit('')
SplitResult(scheme='', netloc='', path='', query='', fragment='')

Here is review275351002 which manages this case.
msg49249 (view) Author: [hidden] (iehoshia) Date: 2019-04-29.20:44:48
How to reproduce: 

1. Loggin in http://demo5.0.tryton.org
2. Activate web_user module
3. Create a user without a party, only e-mail and password.
4. Clic on Validate E-mail 

Traceback (most recent call last):
  File "/usr/local/lib/python35/dist-packages/trytond/wsgipy", line 73, in dispatch_request
    return endpoint(request, **requestview_args)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/dispatcherpy", line 46, in rpc
    request, database_name, *requestrpc_params)
  File "/usr/local/lib/python35/dist-packages/trytond/wsgipy", line 44, in auth_required
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/wrapperspy", line 122, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/dispatcherpy", line 176, in _dispatch
    result = rpcresult(meth(*c_args, **c_kwargs))
  File "/usr/local/lib/python35/dist-packages/trytond/model/modelviewpy", line 665, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/web_user/userpy", line 280, in validate_email
    _send_email(from_, users, clsget_email_validation)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/web_user/userpy", line 47, in _send_email
    msg, title = email_func(user)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/web_user/userpy", line 287, in get_email_validation
    'webuseremail_validation', self, selflanguages)
  File "/usr/local/lib/python35/dist-packages/trytond/report/reportpy", line 385, in get_email
    'language': language,
  File "/usr/local/lib/python35/dist-packages/trytond/report/reportpy", line 182, in execute
    oext, content = cls_execute(records, data, action_report)
  File "/usr/local/lib/python35/dist-packages/trytond/report/reportpy", line 190, in _execute
    return clsconvert(action, clsrender(action, report_context))
  File "/usr/local/lib/python35/dist-packages/trytond/report/reportpy", line 290, in render
    data = rel_report(**report_context)render()
  File "/genshi/corepy", line 184, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "/genshi/outputpy", line 57, in encode
    return _encode(''join(list(iterator)))
  File "/genshi/outputpy", line 241, in __call__
    for kind, data, pos in stream:
  File "/genshi/outputpy", line 669, in __call__
    for kind, data, pos in stream:
  File "/genshi/outputpy", line 774, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/genshi/outputpy", line 594, in __call__
    for ev in stream:
  File "/genshi/corepy", line 289, in _ensure
    for event in stream:
  File "/genshi/corepy", line 289, in _ensure
    for event in stream:
  File "/genshi/filters/i18npy", line 690, in __call__
    for kind, data, pos in stream:
  File "/genshi/template/basepy", line 617, in _include
    for event in stream:
  File "/genshi/template/markuppy", line 326, in _match
    for event in stream:
  File "/genshi/template/basepy", line 567, in _flatten
    for event in self_flatten(value, ctxt, **vars)
  File "/genshi/template/basepy", line 566, in <listcomp>
    values = [event[1]
  File "/genshi/template/basepy", line 577, in _flatten
    result = _eval_expr(data, ctxt, vars)
  File "/genshi/template/basepy", line 289, in _eval_expr
    retval = exprevaluate(ctxt)
  File "/genshi/template/evalpy", line 178, in evaluate
    return eval(selfcode, _globals, {'__data__': data})
  File "/tmp/trytond_ewp91x7yhtml", line 12, in <Expression 'userget_email_validation_url()'>
    <form action="${userget_email_validation_url()}">
  File "/usr/local/lib/python35/dist-packages/trytond/modules/web_user/userpy", line 292, in get_email_validation_url
    return _add_params(url, token=selfemail_token)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/web_user/userpy", line 61, in _add_params
    return urllibparseurlunsplit(parts)
  File "/usr/lib/python35/urllib/parsepy", line 396, in urlunsplit
    _coerce_args(*components))
  File "/usr/lib/python35/urllib/parsepy", line 112, in _coerce_args
    raise TypeError("Cannot mix str and non-str arguments")
TypeError: Cannot mix str and non-str arguments

5. Activate validate e-mail option and after clic on Reset Password: 

Traceback (most recent call last):
  File "/usr/local/lib/python35/dist-packages/trytond/wsgipy", line 73, in dispatch_request
    return endpoint(request, **requestview_args)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/dispatcherpy", line 46, in rpc
    request, database_name, *requestrpc_params)
  File "/usr/local/lib/python35/dist-packages/trytond/wsgipy", line 44, in auth_required
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/wrapperspy", line 122, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/dispatcherpy", line 176, in _dispatch
    result = rpcresult(meth(*c_args, **c_kwargs))
  File "/usr/local/lib/python35/dist-packages/trytond/model/modelviewpy", line 665, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/web_user/userpy", line 326, in reset_password
    _send_email(from_, users, clsget_email_reset_password)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/web_user/userpy", line 47, in _send_email
    msg, title = email_func(user)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/web_user/userpy", line 341, in get_email_reset_password
    'webuseremail_reset_password', self, selflanguages)
  File "/usr/local/lib/python35/dist-packages/trytond/report/reportpy", line 385, in get_email
    'language': language,
  File "/usr/local/lib/python35/dist-packages/trytond/report/reportpy", line 182, in execute
    oext, content = cls_execute(records, data, action_report)
  File "/usr/local/lib/python35/dist-packages/trytond/report/reportpy", line 190, in _execute
    return clsconvert(action, clsrender(action, report_context))
  File "/usr/local/lib/python35/dist-packages/trytond/report/reportpy", line 290, in render
    data = rel_report(**report_context)render()
  File "/genshi/corepy", line 184, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "/genshi/outputpy", line 57, in encode
    return _encode(''join(list(iterator)))
  File "/genshi/outputpy", line 241, in __call__
    for kind, data, pos in stream:
  File "/genshi/outputpy", line 669, in __call__
    for kind, data, pos in stream:
  File "/genshi/outputpy", line 774, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/genshi/outputpy", line 594, in __call__
    for ev in stream:
  File "/genshi/corepy", line 289, in _ensure
    for event in stream:
  File "/genshi/corepy", line 289, in _ensure
    for event in stream:
  File "/genshi/filters/i18npy", line 690, in __call__
    for kind, data, pos in stream:
  File "/genshi/template/basepy", line 617, in _include
    for event in stream:
  File "/genshi/template/markuppy", line 326, in _match
    for event in stream:
  File "/genshi/template/basepy", line 567, in _flatten
    for event in self_flatten(value, ctxt, **vars)
  File "/genshi/template/basepy", line 566, in <listcomp>
    values = [event[1]
  File "/genshi/template/basepy", line 577, in _flatten
    result = _eval_expr(data, ctxt, vars)
  File "/genshi/template/basepy", line 289, in _eval_expr
    retval = exprevaluate(ctxt)
  File "/genshi/template/evalpy", line 178, in evaluate
    return eval(selfcode, _globals, {'__data__': data})
  File "/tmp/trytond_alc91wy8html", line 13, in <Expression 'userget_email_reset_password_url()'>
    <form action="${userget_email_reset_password_url()}">
  File "/usr/local/lib/python35/dist-packages/trytond/modules/web_user/userpy", line 347, in get_email_reset_password_url
    url, token=selfreset_password_token, email=selfemail)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/web_user/userpy", line 61, in _add_params
    return urllibparseurlunsplit(parts)
  File "/usr/lib/python35/urllib/parsepy", line 396, in urlunsplit
    _coerce_args(*components))
  File "/usr/lib/python35/urllib/parsepy", line 112, in _coerce_args
    raise TypeError("Cannot mix str and non-str arguments")
TypeError: Cannot mix str and non-str arguments
History
Date User Action Args
2019-05-20 12:07:15cedsetmessages: + msg49769
2019-05-17 21:35:49reviewbotsetmessages: + msg49761
2019-05-01 22:12:48reviewbotsetmessages: + msg49541
2019-04-30 23:59:07cedsetnosy: + ced
messages: + msg49263
2019-04-30 12:07:32reviewbotsetnosy: + reviewbot
messages: + msg49252
2019-04-30 11:41:32pokolisetstatus: unread -> testing
messages: + msg49251
keyword: + review
nosy: + pokoli
component: + web_user
reviews: 275351002
assignedto: pokoli
2019-04-29 20:44:49iehoshiacreate

Showing 10 items. Show all history (warning: this could be VERY long)