Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DataCatalog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
eFlows4HPC WP2
DataCatalog
Commits
085e4400
Commit
085e4400
authored
4 years ago
by
Christian Boettcher
Browse files
Options
Downloads
Patches
Plain Diff
fix json encoding not automatically supported for custom classes
parent
b009b2cf
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1
apiserver based on fastAPI
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
apiserver/storage/JsonFileStorageAdapter.py
+5
-2
5 additions, 2 deletions
apiserver/storage/JsonFileStorageAdapter.py
with
5 additions
and
2 deletions
apiserver/storage/JsonFileStorageAdapter.py
+
5
−
2
View file @
085e4400
...
@@ -12,6 +12,9 @@ class StoredData:
...
@@ -12,6 +12,9 @@ class StoredData:
actualData
:
LocationData
actualData
:
LocationData
users
:
List
[
str
]
users
:
List
[
str
]
def
toDict
(
self
):
return
{
'
actualData
'
:
self
.
actualData
.
__dict__
,
'
users
'
:
self
.
users
}
# This stores LocationData via the StoredData Object as json files
# This stores LocationData via the StoredData Object as json files
# These Jsonfiles then contain the actualData, as well as the users with permissions for this LocationData
# These Jsonfiles then contain the actualData, as well as the users with permissions for this LocationData
...
@@ -55,7 +58,7 @@ class JsonFileStorageAdapter(AbstractLocationDataStorageAdapter):
...
@@ -55,7 +58,7 @@ class JsonFileStorageAdapter(AbstractLocationDataStorageAdapter):
toStore
.
users
=
[
usr
]
toStore
.
users
=
[
usr
]
toStore
.
actualData
=
data
toStore
.
actualData
=
data
with
open
(
os
.
path
.
join
(
localpath
,
id
),
'
w
'
)
as
json_file
:
with
open
(
os
.
path
.
join
(
localpath
,
id
),
'
w
'
)
as
json_file
:
json
.
dump
(
toStore
.
__d
ict
__
,
json_file
)
json
.
dump
(
toStore
.
toD
ict
()
,
json_file
)
return
{
id
:
data
}
return
{
id
:
data
}
def
getDetails
(
self
,
type
:
LocationDataType
,
id
:
str
):
def
getDetails
(
self
,
type
:
LocationDataType
,
id
:
str
):
...
@@ -82,7 +85,7 @@ class JsonFileStorageAdapter(AbstractLocationDataStorageAdapter):
...
@@ -82,7 +85,7 @@ class JsonFileStorageAdapter(AbstractLocationDataStorageAdapter):
toStore
.
actualData
=
data
toStore
.
actualData
=
data
with
open
(
fullpath
,
'
w
'
)
as
file
:
with
open
(
fullpath
,
'
w
'
)
as
file
:
json
.
dump
(
data
.
__d
ict
__
,
file
)
json
.
dump
(
toStore
.
toD
ict
()
,
file
)
return
{
id
:
data
}
return
{
id
:
data
}
def
getOwner
(
self
,
type
:
LocationDataType
,
id
:
str
):
def
getOwner
(
self
,
type
:
LocationDataType
,
id
:
str
):
...
...
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