#405 Don't confuse `ProviderException.code` with `ProviderException.statuscode`
Merged 3 months ago by ngompa. Opened 3 months ago by abompard.

@@ -59,10 +59,10 @@ 

              request = self._parse_request(**kwargs)

              return self._openid_checks(request, form, **kwargs)

          except InvalidRequest as e:

-             raise cherrypy.HTTPError(e.code, e.message)

+             raise cherrypy.HTTPError(e.statuscode, e.message)

          except UnauthorizedRequest as e:

              if request is None:

-                 raise cherrypy.HTTPError(e.code, e.message)

+                 raise cherrypy.HTTPError(e.statuscode, e.message)

              return self._respond(request.answer(False))

  

      # get attributes, and apply policy mapping and filtering

file modified
+1 -1
@@ -38,7 +38,7 @@ 

              if exc is None and not self.should_fail:

                  TC.output_method(TC.prefix + 'done')

              elif not self.should_fail:

-                 print_exception(exc)

+                 print_exception(exc_class, exc, tb)

                  TC.output_method(TC.prefix + 'fail:' + repr(exc))

                  sys.exit(1)

              elif not exc:

Fix some errors such as:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/cherrypy/_cprequest.py", line 638, in respond
    self._do_respond(path_info)
  File "/usr/lib/python3.12/site-packages/cherrypy/_cprequest.py", line 697, in _do_respond
    response.body = self.handler()
                    ^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/cherrypy/lib/encoding.py", line 223, in __call__
    self.body = self.oldhandler(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__
    return self.callable(*self.args, **self.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ipsilon/util/page.py", line 85, in __call__
    return op(*args, **kwargs).encode('utf-8')
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ipsilon/providers/common.py", line 105, in root
    return op(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ipsilon/providers/openid/auth.py", line 297, in GET
    return self.auth(**kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ipsilon/providers/openid/auth.py", line 59, in auth
    raise cherrypy.HTTPError(e.code, e.message)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/cherrypy/_cperror.py", line 378, in __init__
    raise ValueError('status must be between 400 and 599.')

Pull-Request has been merged by ngompa

3 months ago