Skip to content
Snippets Groups Projects

BUG: Request responses without the "Set-Cookie" header no longer overwrite the...

Merged Florian Spreckelsen requested to merge release-0.17.0 into main
32 files
+ 791
315
Compare changes
  • Side-by-side
  • Inline
Files
32
@@ -78,7 +78,7 @@ Examples
Finding parents and properties
--------
------------------------------
To find a specific parent or property of an Entity, its
ParentList or PropertyList can be filtered using names, ids, or
entities. A short example:
@@ -100,29 +100,45 @@ entities. A short example:
properties = r.properties
# As r only has one property with id 101, this returns a list containing only p1_1
properties.filter(pid=101)
properties.filter_by_identity(pid=101)
# Result: [p1_1]
# Filtering with name="Property 1" returns both p1_1 and p1_2, as they share their name
properties.filter(name="Property 1")
properties.filter_by_identity(name="Property 1")
# Result: [p1_1, p1_2]
# If both name and pid are given, matching is based only on pid for all entities that have an id
properties.filter(pid="102", name="Other Property")
properties.filter_by_identity(pid="102", name="Other Property")
# Result: [p2_1, p2_2, p2_3]
# However, filtering with name="Property 1" and id=101 returns both p1_1 and p1_2, because
# However, filter_by_identity with name="Property 1" and id=101 returns both p1_1 and p1_2, because
# p1_2 does not have an id and matches the name
properties.filter(pid="101", name="Property 1")
properties.filter_by_identity(pid="101", name="Property 1")
# Result: [p1_1, p1_2]
# We can also filter using an entity, in which case the name and id of the entity are used:
properties.filter(pid="102", name="Property 2") == properties.filter(p2_1)
properties.filter_by_identity(pid="102", name="Property 2") == properties.filter_by_identity(p2_1)
# Result: True
# If we only need properties that match both id and name, we can set the parameter
# conjunction to True:
properties.filter(pid="102", name="Property 2", conjunction=True)
properties.filter_by_identity(pid="102", name="Property 2", conjunction=True)
# Result: [p2_1]
The filter function of ParentList works analogously.
Finding entities in a Container
-------------------------------
In the same way as described above, Container can be filtered.
A short example:
.. code-block:: python3
import linkahead as db
# Setup a record with six properties
p1 = db.Property(id=101, name="Property 1")
p2 = db.Property(name="Property 2")
c = db.Container().extend([p1,p2])
c.filter_by_identity(name="Property 1")
# Result: [p1]
Loading