Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
29065d2d
authored
Nov 27, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: revise exception implementations
parent
85f21572
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
circle/storage/models.py
+17
-11
No files found.
circle/storage/models.py
View file @
29065d2d
...
...
@@ -60,21 +60,27 @@ class Disk(TimeStampedModel):
verbose_name_plural
=
_
(
'disks'
)
class
WrongDiskTypeError
(
Exception
):
def
__init__
(
self
,
type
):
self
.
type
=
type
def
__str__
(
self
):
return
(
"Operation can't be invoked on a disk of type '
%
s'."
%
self
.
type
)
def
__init__
(
self
,
type
,
message
=
None
):
if
message
is
None
:
message
=
(
"Operation can't be invoked on a disk of type '
%
s'."
%
type
)
Exception
.
__init__
(
self
,
message
)
self
.
type
=
type
class
DiskInUseError
(
Exception
):
def
__init__
(
self
,
disk
):
self
.
disk
=
disk
def
__str__
(
self
):
return
(
"The requested operation can't be performed on disk "
"'
%
s (
%
s)' because it is in use."
%
(
self
.
disk
.
name
,
self
.
disk
.
filename
))
def
__init__
(
self
,
disk
,
message
=
None
):
if
message
is
None
:
message
=
(
"The requested operation can't be performed on "
"disk '
%
s (
%
s)' because it is in use."
%
(
self
.
disk
.
name
,
self
.
disk
.
filename
))
Exception
.
__init__
(
self
,
message
)
self
.
disk
=
disk
@property
def
path
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment