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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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):
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."
%
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
):
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