Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Changelog
applied. Uninstalling from the same panel removes the PAS plugin
and the per-user JWT signing secrets.

- #118 Set a file field through its field manager, not the raw mutator
- #109 Add a partition operation endpoint
- #106 Fix single-valued UID reference fields not settable through the JSON API
- #112 Allow updating the Laboratory through the API
Expand Down
12 changes: 11 additions & 1 deletion src/senaite/jsonapi/datamanagers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@
from senaite.jsonapi.interfaces import IDataManager
from senaite.jsonapi.interfaces import IFieldManager
from senaite.jsonapi.fieldmanagers import DurationFieldManager
from senaite.jsonapi.fieldmanagers import NamedFileFieldManager
from senaite.jsonapi.fieldmanagers import UIDReferenceFieldMixin

# Field managers that normalize the incoming value (resolve UIDs, coerce
# a duration mapping to a timedelta, ...). For these the raw set<Name>
# mutator would store the value unconverted, so the data manager must go
# through the field manager instead of the setter.
NORMALIZING_FIELD_MANAGERS = (UIDReferenceFieldMixin, DurationFieldManager)
NORMALIZING_FIELD_MANAGERS = (
UIDReferenceFieldMixin,
DurationFieldManager,
# A file arrives as base64 text and the manager decodes it and
# builds the NamedFile or NamedImage the field holds. The raw
# mutator would store the text itself, which the field then fails
# to validate as the wrong type. NamedImageFieldManager is a
# subclass, so it is covered here too.
NamedFileFieldManager,
)


class BaseDataManager(object):
Expand Down
Loading