Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.web
Commits
c035a044
Commit
c035a044
authored
6 years ago
by
Samuel GAIST
Browse files
Options
Downloads
Patches
Plain Diff
[plotters][serializers] Fix key search in dictionaries
parent
9d26484d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!255
1.4.x
,
!242
Py3 compatibility
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/web/plotters/serializers.py
+5
-5
5 additions, 5 deletions
beat/web/plotters/serializers.py
with
5 additions
and
5 deletions
beat/web/plotters/serializers.py
+
5
−
5
View file @
c035a044
...
@@ -119,7 +119,7 @@ class PlotterParameterCreationSerializer(ContributionCreationSerializer):
...
@@ -119,7 +119,7 @@ class PlotterParameterCreationSerializer(ContributionCreationSerializer):
def
create
(
self
,
validated_data
):
def
create
(
self
,
validated_data
):
plotterparameter
=
None
plotterparameter
=
None
if
not
validated_data
.
has_key
(
"
name
"
)
:
if
"
name
"
not
in
validated_data
:
raise
serializers
.
ValidationError
(
'
No name provided
'
)
raise
serializers
.
ValidationError
(
'
No name provided
'
)
try
:
try
:
...
@@ -130,7 +130,7 @@ class PlotterParameterCreationSerializer(ContributionCreationSerializer):
...
@@ -130,7 +130,7 @@ class PlotterParameterCreationSerializer(ContributionCreationSerializer):
if
plotterparameter
is
not
None
:
if
plotterparameter
is
not
None
:
raise
serializers
.
ValidationError
(
'
A plotterparameter with this name already exists
'
)
raise
serializers
.
ValidationError
(
'
A plotterparameter with this name already exists
'
)
if
not
self
.
data
.
has_key
(
"
plotter
"
)
:
if
"
plotter
"
not
in
self
.
data
:
raise
serializers
.
ValidationError
(
'
No plotter provided
'
)
raise
serializers
.
ValidationError
(
'
No plotter provided
'
)
plotter
=
None
plotter
=
None
...
@@ -142,11 +142,11 @@ class PlotterParameterCreationSerializer(ContributionCreationSerializer):
...
@@ -142,11 +142,11 @@ class PlotterParameterCreationSerializer(ContributionCreationSerializer):
if
plotter
is
None
:
if
plotter
is
None
:
raise
serializers
.
ValidationError
(
'
Required plotter does not exist
'
)
raise
serializers
.
ValidationError
(
'
Required plotter does not exist
'
)
if
not
validated_data
.
has_key
(
"
data
"
)
:
if
"
data
"
not
in
validated_data
:
validated_data
[
'
data
'
]
=
{}
validated_data
[
'
data
'
]
=
{}
#Only create new version for latest version
#Only create new version for latest version
if
validated_data
.
has_key
(
"
previous_version
"
)
:
if
"
previous_version
"
in
validated_data
:
if
validated_data
[
'
previous_version
'
].
version
<
validated_data
[
'
version
'
]
-
1
:
if
validated_data
[
'
previous_version
'
].
version
<
validated_data
[
'
version
'
]
-
1
:
raise
serializers
.
ValidationError
(
'
A new version for this plotterparameter version already exist
'
)
raise
serializers
.
ValidationError
(
'
A new version for this plotterparameter version already exist
'
)
...
@@ -155,7 +155,7 @@ class PlotterParameterCreationSerializer(ContributionCreationSerializer):
...
@@ -155,7 +155,7 @@ class PlotterParameterCreationSerializer(ContributionCreationSerializer):
validated_data
[
'
description
'
]
=
validated_data
[
'
previous_version
'
].
description
validated_data
[
'
description
'
]
=
validated_data
[
'
previous_version
'
].
description
#Create fork
#Create fork
if
validated_data
.
has_key
(
"
fork_of
"
)
:
if
"
fork_of
"
in
validated_data
:
#add description/short_description to new version
#add description/short_description to new version
validated_data
[
'
short_description
'
]
=
validated_data
[
'
fork_of
'
].
short_description
validated_data
[
'
short_description
'
]
=
validated_data
[
'
fork_of
'
].
short_description
validated_data
[
'
description
'
]
=
validated_data
[
'
fork_of
'
].
description
validated_data
[
'
description
'
]
=
validated_data
[
'
fork_of
'
].
description
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment