Skip to content

Improving the __repr__ method of _Context #65

Closed
@zachary822

Description

@zachary822

UserDict.__repr__ attempting to print the contents of _Context.data outside of a starlette app raises starlette_context.errors.ContextDoesNotExistError. Can we make the __repr__ return something that indicates that rather than raising exception?

Current problem:

# some route.py
"""
Module docstring
"""
from starlette_context import context
...

# in python console
import route
help(route)  # raises exception

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions