Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
feudal
feudalBackend
Commits
22d329d4
Commit
22d329d4
authored
Nov 20, 2018
by
Lukas Burgey
Browse files
Check before accessing a nullable property
parent
95d81690
Changes
1
Hide whitespace changes
Inline
Side-by-side
feudal/backend/models/__init__.py
View file @
22d329d4
...
...
@@ -199,7 +199,10 @@ class NewDeployment(models.Model):
@
property
def
services
(
self
):
return
self
.
vo
.
services
.
all
()
if
self
.
vo
is
not
None
:
return
self
.
vo
.
services
.
all
()
else
:
return
Service
.
objects
.
none
()
@
property
def
sites
(
self
):
...
...
@@ -303,10 +306,11 @@ class NewDeployment(models.Model):
data
=
NewDeploymentSerializer
(
self
).
data
msg
=
dumps
(
data
)
RabbitMQInstance
.
load
().
publish_by_vo
(
self
.
vo
,
msg
,
)
if
self
.
vo
is
not
None
:
RabbitMQInstance
.
load
().
publish_by_vo
(
self
.
vo
,
msg
,
)
# sends a state update via RabbitMQ / STOMP to the users webpage instance
def
publish_to_user
(
self
):
...
...
@@ -336,11 +340,17 @@ class NewDeployment(models.Model):
self
.
save
()
def
__str__
(
self
):
return
'VO-Dep: ({}:{})#{}'
.
format
(
self
.
vo
,
self
.
user
,
self
.
id
,
)
if
self
.
vo
is
not
None
:
return
'VO-Dep: ({}:{})#{}'
.
format
(
self
.
vo
,
self
.
user
,
self
.
id
,
)
else
:
return
'VO-Dep: (!NO-VO!:{})#{}'
.
format
(
self
.
user
,
self
.
id
,
)
class
NewDeploymentStateItem
(
models
.
Model
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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