Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
circle/storage/models.py
+16
-10
No files found.
circle/storage/models.py
View file @
29065d2d
...
@@ -60,22 +60,28 @@ class Disk(TimeStampedModel):
...
@@ -60,22 +60,28 @@ 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 "
"disk '
%
s (
%
s)' because it is in use."
%
(
self
.
disk
.
name
,
self
.
disk
.
filename
))
(
self
.
disk
.
name
,
self
.
disk
.
filename
))
Exception
.
__init__
(
self
,
message
)
self
.
disk
=
disk
@property
@property
def
path
(
self
):
def
path
(
self
):
return
self
.
datastore
.
path
+
'/'
+
self
.
filename
return
self
.
datastore
.
path
+
'/'
+
self
.
filename
...
...
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