Skip to content
Snippets Groups Projects
Commit d1456413 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'f-id-path' into f-refactor-merge

parents 13114a96 b65db7cc
No related branches found
No related tags found
4 merge requests!160STY: styling,!153MAINT: refactor merge into new function,!152MAINT: move checks that are not related to identifiables,!151New class to track treated Records during sync
Pipeline #47437 passed
......@@ -8,26 +8,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ##
### Added ###
* 'transform' sections can be added to a CFood to apply functions to values stored in variables.
* `transform` sections can be added to a CFood to apply functions to values stored in variables.
* default transform functions: submatch, split and replace.
* `*` can now be used as a wildcard in the identifiables parameter file to denote
that any Record may reference the identified one.
* `crawl.TreatedRecordLookUp` class replacing the old (and slow)
`identified_cache` module. The new class now handles all records identified by
id, path, or identifiable simultaneously. See API docs for more info on how to
add to and get from the new lookup class.
### Changed ###
- If the `parents` key is used in a cfood at a lower level for a Record that
* If the `parents` key is used in a cfood at a lower level for a Record that
already has a Parent (because it was explicitly given or the default Parent),
the old Parent(s) are now overwritten with the value belonging to the
`parents` key.
- If a registered identifiable states, that a reference by a Record with parent
* If a registered identifiable states, that a reference by a Record with parent
RT1 is needed, then now also references from Records that have a child of RT1
as parent are accepted.
- More aggressive caching.
* More aggressive caching.
### Deprecated ###
- `IdentifiableAdapter.get_file`
* `IdentifiableAdapter.get_file`
### Removed ###
* `identified_cache` module which was replaced by the `crawl.TreatedRecordLookUp` class.
### Fixed ###
* Empty Records can now be created (https://gitlab.com/caosdb/caosdb-crawler/-/issues/27)
......
......@@ -243,7 +243,7 @@ class TreatedRecordLookUp():
In the case that the Record is not yet in the remote server, there cannot be a Python object
with an ID. Thus we might have one with a path and one with an identifiable. If that Record
does not yet exist, it is necessary that both Python objects have at least either the path or
the identifiable in common. Currently, this has to be assured by the user.
the identifiable in common.
"""
def __init__(self):
......
......@@ -978,8 +978,6 @@ def test_treated_record_lookup():
assert trlu._id_look_up[exist.id] is exist
# can be accessed via get_existing
assert trlu.get_existing(db.Record(id=1)) is exist
# assert trlu.is_existing(db.Record(id=1)) # TODO remove?
# assert not trlu.is_missing(db.Record(id=1)) # TODO remove?
miss = db.Record()
# exception when identifiable is missing
......@@ -993,8 +991,6 @@ def test_treated_record_lookup():
assert trlu._identifiable_look_up[ident.get_representation()] is miss
# can be accessed via get_missing
assert trlu.get_missing(db.Record(), Identifiable(name='a')) is miss
# assert not trlu.is_existing(db.Record()) # TODO remove?
# assert trlu.is_missing(db.Record()) # TODO remove?
fi = db.File(path='a', id=2)
trlu.add(fi)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment