Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
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):
...
@@ -60,21 +60,27 @@ class Disk(TimeStampedModel):
verbose_name_plural
=
_
(
'disks'
)
verbose_name_plural
=
_
(
'disks'
)
class
WrongDiskTypeError
(
Exception
):
class
WrongDiskTypeError
(
Exception
):
def
__init__
(
self
,
type
):
self
.
type
=
type
def
__str__
(
self
):
def
__init__
(
self
,
type
,
message
=
None
):
return
(
"Operation can't be invoked on a disk of type '
%
s'."
%
if
message
is
None
:
self
.
type
)
message
=
(
"Operation can't be invoked on a disk of type '
%
s'."
%
type
)
Exception
.
__init__
(
self
,
message
)
self
.
type
=
type
class
DiskInUseError
(
Exception
):
class
DiskInUseError
(
Exception
):
def
__init__
(
self
,
disk
):
self
.
disk
=
disk
def
__str__
(
self
):
def
__init__
(
self
,
disk
,
message
=
None
):
return
(
"The requested operation can't be performed on disk "
if
message
is
None
:
"'
%
s (
%
s)' because it is in use."
%
message
=
(
"The requested operation can't be performed on "
(
self
.
disk
.
name
,
self
.
disk
.
filename
))
"disk '
%
s (
%
s)' because it is in use."
%
(
self
.
disk
.
name
,
self
.
disk
.
filename
))
Exception
.
__init__
(
self
,
message
)
self
.
disk
=
disk
@property
@property
def
path
(
self
):
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