diff --git a/docs/source/migrate.rst b/docs/source/migrate.rst index 9fc151b..9595c27 100644 --- a/docs/source/migrate.rst +++ b/docs/source/migrate.rst @@ -88,6 +88,20 @@ While in v1 entries were represented as dicts, in v2 they are represented as ``E # ... but to facilitate migration or simple cases, this shorthand notation also works ... print(entry['title']) +If you need plain dicts as in v1, e.g. to pass entries on to another library, convert them: + +.. code-block:: python + + # v1 + entries = bib_database.entries + entries_dict = bib_database.entries_dict + + # v2 + entries = [dict(entry) for entry in library.entries] + entries_dict = {entry["ID"]: entry for entry in entries} + +Field values are whatever the middleware produced (e.g. a list of names after ``SeparateCoAuthors``), not necessarily strings. + Similarly, other block types (comments, strings, ...) are now also represented as dedicated :ref:`object types `, but for them, the migration is straight forward and we will not go into detail here.