Skip to content
This repository has been archived by the owner on Oct 24, 2018. It is now read-only.

Commit

Permalink
somes simples fixs: doc, one import per line, exception_name, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
inkhey committed Jun 21, 2018
1 parent 4217420 commit 1d428e8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 356 deletions.
4 changes: 2 additions & 2 deletions tracim/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ class UserNotFoundInTracimRequest(TracimException):
pass


class NotSameWorkspace(TracimException):
pass
class WorkspacesDoNotMatch(TracimException):
pass
4 changes: 2 additions & 2 deletions tracim/lib/core/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from tracim.lib.utils.utils import cmp_to_key
from tracim.lib.core.notifications import NotifierFactory
from tracim.exceptions import SameValueError
from tracim.exceptions import NotSameWorkspace
from tracim.exceptions import WorkspacesDoNotMatch
from tracim.lib.utils.utils import current_date_for_filename
from tracim.models.revision_protection import new_revision
from tracim.models.auth import User
Expand Down Expand Up @@ -878,7 +878,7 @@ def move(self,
item.workspace = new_workspace
if new_parent and \
new_parent.workspace_id != new_workspace.workspace_id:
raise NotSameWorkspace(
raise WorkspacesDoNotMatch(
'new parent workspace and new workspace should be the same.'
)
else:
Expand Down
5 changes: 2 additions & 3 deletions tracim/lib/utils/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
except ImportError: # python3.4
JSONDecodeError = ValueError

from tracim.exceptions import InsufficientUserWorkspaceRole, \
InsufficientUserProfile, WorkspaceNotFoundInTracimRequest

from tracim.exceptions import InsufficientUserWorkspaceRole
from tracim.exceptions import InsufficientUserProfile
if TYPE_CHECKING:
from tracim import TracimRequest
###
Expand Down
11 changes: 5 additions & 6 deletions tracim/lib/utils/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from pyramid.request import Request
from sqlalchemy.orm.exc import NoResultFound

from tracim.exceptions import NotAuthenticated, WorkspaceNotFoundInTracimRequest
from tracim.exceptions import NotAuthenticated
from tracim.exceptions import WorkspaceNotFoundInTracimRequest
from tracim.exceptions import UserNotFoundInTracimRequest
from tracim.exceptions import UserDoesNotExist
from tracim.exceptions import WorkspaceNotFound
Expand Down Expand Up @@ -59,7 +60,7 @@ def current_workspace(self) -> Workspace:
:return: Workspace of the request
"""
if self._current_workspace is None:
self.current_workspace = self._get_current_workspace(self.current_user, self)
self._current_workspace = self._get_current_workspace(self.current_user, self)
return self._current_workspace

@current_workspace.setter
Expand Down Expand Up @@ -108,10 +109,8 @@ def candidate_user(self) -> User:
@property
def candidate_workspace(self) -> Workspace:
"""
Get user from headers/body request. This user is not
the one found by authentication mecanism. This user
can help user to know about who one page is about in
a similar way as current_workspace.
Get workspace from headers/body request. This workspace is not
the one found from path. Its the one from json body.
"""
if self._candidate_workspace is None:
self._candidate_workspace = self._get_candidate_workspace(
Expand Down

0 comments on commit 1d428e8

Please sign in to comment.