Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
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
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
7f0153d5
Commit
7f0153d5
authored
1 year ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
MAINT: quote name and cache query
parent
6fd897f7
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!160
STY: styling
Pipeline
#47056
passed
1 year ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caoscrawler/identifiable_adapters.py
+3
-4
3 additions, 4 deletions
src/caoscrawler/identifiable_adapters.py
with
3 additions
and
4 deletions
src/caoscrawler/identifiable_adapters.py
+
3
−
4
View file @
7f0153d5
...
@@ -27,8 +27,8 @@ from __future__ import annotations
...
@@ -27,8 +27,8 @@ from __future__ import annotations
import
logging
import
logging
from
abc
import
ABCMeta
,
abstractmethod
from
abc
import
ABCMeta
,
abstractmethod
from
functools
import
lru_cache
from
datetime
import
datetime
from
datetime
import
datetime
from
functools
import
lru_cache
from
typing
import
Any
from
typing
import
Any
import
caosdb
as
db
import
caosdb
as
db
...
@@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
...
@@ -44,7 +44,7 @@ logger = logging.getLogger(__name__)
def
get_children_of_rt
(
rtname
):
def
get_children_of_rt
(
rtname
):
"""
Supply the name of a recordtype. This name and the name of all children RTs are returned in
"""
Supply the name of a recordtype. This name and the name of all children RTs are returned in
a list
"""
a list
"""
return
[
p
.
name
for
p
in
cached_query
(
f
"
FIND RECORDTYPE
{
rtname
}
"
)]
return
[
p
.
name
for
p
in
cached_query
(
f
"
FIND RECORDTYPE
'
{
rtname
}
'
"
)]
def
convert_value
(
value
:
Any
):
def
convert_value
(
value
:
Any
):
...
@@ -477,8 +477,7 @@ class CaosDBIdentifiableAdapter(IdentifiableAdapter):
...
@@ -477,8 +477,7 @@ class CaosDBIdentifiableAdapter(IdentifiableAdapter):
return
cached_get_entity_by
(
path
=
identifiable
)
return
cached_get_entity_by
(
path
=
identifiable
)
if
identifiable
.
path
is
None
:
if
identifiable
.
path
is
None
:
raise
RuntimeError
(
"
Path must not be None for File retrieval.
"
)
raise
RuntimeError
(
"
Path must not be None for File retrieval.
"
)
candidates
=
db
.
execute_query
(
"
FIND File which is stored at
'
{}
'"
.
format
(
candidates
=
cached_get_entity_by
(
path
=
identifiable
.
path
)
identifiable
.
path
))
if
len
(
candidates
)
>
1
:
if
len
(
candidates
)
>
1
:
raise
RuntimeError
(
"
Identifiable was not defined unambigiously.
"
)
raise
RuntimeError
(
"
Identifiable was not defined unambigiously.
"
)
if
len
(
candidates
)
==
0
:
if
len
(
candidates
)
==
0
:
...
...
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