Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
caosdb
Software
caosdb-pylib
Commits
d2fb4286
Verified
Commit
d2fb4286
authored
2 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
WIP: file storage: link
parent
769db33e
Branches
Branches containing commit
No related tags found
1 merge request
!87
Draft: ENH: file system: link
Pipeline
#31791
passed
2 years ago
Stage: code_style
Stage: linting
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caosdb/common/models.py
+9
-37
9 additions, 37 deletions
src/caosdb/common/models.py
unittests/test_datatype.py
+6
-0
6 additions, 0 deletions
unittests/test_datatype.py
with
15 additions
and
37 deletions
src/caosdb/common/models.py
+
9
−
37
View file @
d2fb4286
...
@@ -1396,7 +1396,7 @@ def _parse_value(datatype, value):
...
@@ -1396,7 +1396,7 @@ def _parse_value(datatype, value):
# This is for a special case, where the xml parser could not differentiate
# This is for a special case, where the xml parser could not differentiate
# between single values and lists with one element. As
# between single values and lists with one element. As
if
hasattr
(
value
,
"
__len__
"
)
and
len
(
value
)
==
1
:
if
hasattr
(
value
,
"
__len__
"
)
and
len
(
value
)
==
1
and
not
isinstance
(
value
,
str
)
:
return
_parse_value
(
datatype
,
value
[
0
])
return
_parse_value
(
datatype
,
value
[
0
])
# deal with references
# deal with references
...
@@ -1450,23 +1450,12 @@ class QueryTemplate():
...
@@ -1450,23 +1450,12 @@ class QueryTemplate():
self
.
description
=
description
self
.
description
=
description
self
.
query
=
query
self
.
query
=
query
self
.
_cuid
=
None
self
.
_cuid
=
None
self
.
value
=
None
self
.
datatype
=
None
self
.
messages
=
_Messages
()
self
.
messages
=
_Messages
()
self
.
properties
=
None
self
.
parents
=
None
self
.
path
=
None
self
.
file
=
None
self
.
_checksum
=
None
self
.
_size
=
None
self
.
_upload
=
None
self
.
unit
=
None
self
.
acl
=
None
self
.
acl
=
None
self
.
permissions
=
None
self
.
permissions
=
None
self
.
is_valid
=
lambda
:
False
self
.
is_valid
=
lambda
:
False
self
.
is_deleted
=
lambda
:
False
self
.
is_deleted
=
lambda
:
False
self
.
version
=
None
self
.
version
=
None
self
.
state
=
None
def
retrieve
(
self
,
raise_exception_on_error
=
True
,
unique
=
True
,
sync
=
True
,
def
retrieve
(
self
,
raise_exception_on_error
=
True
,
unique
=
True
,
sync
=
True
,
flags
=
None
):
flags
=
None
):
...
@@ -2556,31 +2545,13 @@ def _basic_sync(e_local, e_remote):
...
@@ -2556,31 +2545,13 @@ def _basic_sync(e_local, e_remote):
"
this client did
'
t know about it yet.
"
.
format
(
"
this client did
'
t know about it yet.
"
.
format
(
e_remote
.
role
,
e_local
.
role
))
e_remote
.
role
,
e_local
.
role
))
e_local
.
id
=
e_remote
.
id
for
attr
in
[
"
path
"
,
"
link_target
"
,
"
_checksum
"
,
"
_size
"
,
"
datatype
"
,
e_local
.
name
=
e_remote
.
name
"
unit
"
,
"
value
"
,
"
properties
"
,
"
parents
"
,
"
messages
"
,
"
acl
"
,
e_local
.
description
=
e_remote
.
description
"
permissions
"
,
"
is_valid
"
,
"
is_deleted
"
,
"
version
"
,
"
state
"
,
e_local
.
path
=
e_remote
.
path
"
query
"
,
"
affiliation
"
,
"
id
"
,
"
name
"
,
"
description
"
]:
e_local
.
link_target
=
e_remote
.
link_target
e_local
.
_checksum
=
e_remote
.
_checksum
if
hasattr
(
e_remote
,
attr
):
e_local
.
_size
=
e_remote
.
_size
setattr
(
e_local
,
attr
,
getattr
(
e_remote
,
attr
))
e_local
.
datatype
=
e_remote
.
datatype
e_local
.
unit
=
e_remote
.
unit
e_local
.
value
=
e_remote
.
value
e_local
.
properties
=
e_remote
.
properties
e_local
.
parents
=
e_remote
.
parents
e_local
.
messages
=
e_remote
.
messages
e_local
.
acl
=
e_remote
.
acl
e_local
.
permissions
=
e_remote
.
permissions
e_local
.
is_valid
=
e_remote
.
is_valid
e_local
.
is_deleted
=
e_remote
.
is_deleted
e_local
.
version
=
e_remote
.
version
e_local
.
state
=
e_remote
.
state
if
hasattr
(
e_remote
,
"
query
"
):
e_local
.
query
=
e_remote
.
query
if
hasattr
(
e_remote
,
"
affiliation
"
):
e_local
.
affiliation
=
e_remote
.
affiliation
return
e_local
return
e_local
...
@@ -3064,6 +3035,7 @@ class Container(list):
...
@@ -3064,6 +3035,7 @@ class Container(list):
for
local_entity
in
self
:
for
local_entity
in
self
:
if
(
sync_dict
[
local_entity
]
is
None
if
(
sync_dict
[
local_entity
]
is
None
and
hasattr
(
local_entity
,
"
path
"
)
and
local_entity
.
path
is
not
None
):
and
local_entity
.
path
is
not
None
):
sync_remote_entities
=
[]
sync_remote_entities
=
[]
...
...
This diff is collapsed.
Click to expand it.
unittests/test_datatype.py
+
6
−
0
View file @
d2fb4286
...
@@ -87,3 +87,9 @@ def test_parsing_of_references():
...
@@ -87,3 +87,9 @@ def test_parsing_of_references():
entity
=
db
.
Record
(
name
=
"
bla
"
)
entity
=
db
.
Record
(
name
=
"
bla
"
)
assert
id
(
_parse_value
(
dtype
,
entity
))
==
id
(
entity
)
assert
id
(
_parse_value
(
dtype
,
entity
))
==
id
(
entity
)
def
test_parsing_of_single_list_item_str_len_one
():
db
.
Record
().
add_property
(
"
blub
"
,
datatype
=
db
.
LIST
(
db
.
TEXT
),
value
=
[
"
a
"
])
db
.
Record
().
add_property
(
"
blub
"
,
datatype
=
db
.
LIST
(
db
.
INTEGER
),
value
=
[
1
])
db
.
Record
().
add_property
(
"
blub
"
,
datatype
=
db
.
LIST
(
"
bla
"
),
value
=
[
"
a
"
])
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