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

DOC: Add callback example

parent a4218614
No related branches found
No related tags found
2 merge requests!178FIX: #96 Better error output for crawl.py script.,!163F dict heuristic
......@@ -362,12 +362,22 @@ exactly a Record as an argument and needs to return that Record after
doing whatever custom treatment is needed. Additionally, it is given
the ``RecordStore`` and the ``ValueStore`` in order to be able to
access the records and values that have already been defined from
within ``referenced_record_callback``. It is applied to all Records
that are created from the dictionary and it can be used to, e.g.,
transform values of some properties, or add special treatment to all
Records of a specific type. ``referenced_record_callback`` is applied
**after** the properties from the dictionary have been applied as
explained above.
within ``referenced_record_callback``. Such a function might look the
following:
.. code-block:: python
def my_callback(rec: db.Record, records: RecordStore, values: GeneralStore):
# do something with rec, possibly using other records or values from the stores...
rec.description = "This was updated in a callback"
return rec
It is applied to all Records that are created from the dictionary and
it can be used to, e.g., transform values of some properties, or add
special treatment to all Records of a specific
type. ``referenced_record_callback`` is applied **after** the
properties from the dictionary have been applied as explained above.
Further converters
++++++++++++++++++
......
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