You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'(see the Sessions chapter of the Pyramid documentation)'
)
returnfactory(self)
It would be beneficial if Pyramid were to raise a custom subclass of AttributeError. It could be something as generic as this:
class PyramidConfigurationError(AttributeError):
pass
This would be backwards compatible with existing code, but allow better control over detecting a non-configured session.
Right now, the exception string must be analyzed
try:
session = request.session
...
do things
...
except AttributeError as exc:
if exc.args[0].startswith("No session factory registered"):
do_something()
else:
do_something_else()
It would be preferable to catch it directly, like:
Feature Request
When there is a configuration issue, such as no session factory configured, Pyramid raises a standard AttributeError. See:
pyramid/src/pyramid/request.py
Lines 189 to 201 in 68a6cb1
It would be beneficial if Pyramid were to raise a custom subclass of AttributeError. It could be something as generic as this:
This would be backwards compatible with existing code, but allow better control over detecting a non-configured session.
Right now, the exception string must be analyzed
It would be preferable to catch it directly, like:
I'm not sure how many other Pyramid components would benefit from this, so I understand the concern over its overall utility.
The text was updated successfully, but these errors were encountered: