for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from contextlib import contextmanager
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
class SomeClass: def some_method(self): """Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.
from pyramid.decorator import reify
from pyramid.request import Request
from tracim.models import User
from tracim.models.data import Workspace
from tracim.lib.utils.auth import get_safe_user
from tracim.lib.utils.auth import get_workspace
class TracimRequest(Request):
__class__
def __init__(
self,
environ,
charset=None,
unicode_errors=None,
decode_param_names=None,
**kw
):
super().__init__(
charset,
unicode_errors,
decode_param_names,
)
self._current_workspace = None # type: Workspace
self._current_user = None # type: User
@property
def current_workspace(self) -> Workspace:
if self._current_workspace is None:
self.current_workspace = get_workspace(self.current_user, self)
return self._current_workspace
@current_workspace.setter
def current_workspace(self, workspace: Workspace) -> None:
assert self._current_workspace is None
self._current_workspace = workspace
def current_user(self) -> User:
if self._current_user is None:
self.current_user = get_safe_user(self)
return self._current_user
@current_user.setter
def current_user(self, user: User) -> None:
assert self._current_user is None
self._current_user = user
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.