The add_session_metadata api results in a 500.
There are two separate issues in the implementation as it exists today. Session.metadata_objects does not exist but rather Session.metadata_items is the correct attribute and then the key doesnt get set. Its unclear whether add_session_metadata is intended to add one item at a time or if the metadata dict is intended to set multiple items one for each key. Depending on the intent either of the following implementation works.
One Item per call
@API
def add_session_metadata(id: int, key: str, metadata: Any):
try:
session = Session.query.filter(Session.id == id).one()
session.metadata_items.append(
SessionMetadata(key=key, metadata_item=metadata))
except NoResultFound:
abort(requests.codes.not_found)
db.session.commit()
Multiple Items per call
@API
def add_session_metadata(id: int, metadata: dict):
try:
session = Session.query.filter(Session.id == id).one()
for key, value in metadata.items():
session.metadata_items.append(
SessionMetadata(key=key, metadata_item=value))
except NoResultFound:
abort(requests.codes.not_found)
db.session.commit()
Personally I prefer the multiple items per call approach.
Finally I suspect add_test_metadata has a similar issue but I havent tested it yet. Just looking at the source I believe it should be test.metadatas and not test.metadata_objects and similar with the missing key parameter to the TestMetadata constructor.
@vmalloc If i submit fixes will they be taken? It seems like development has really slowed down.
The
add_session_metadataapi results in a 500.There are two separate issues in the implementation as it exists today.
Session.metadata_objectsdoes not exist but ratherSession.metadata_itemsis the correct attribute and then the key doesnt get set. Its unclear whetheradd_session_metadatais intended to add one item at a time or if the metadata dict is intended to set multiple items one for each key. Depending on the intent either of the following implementation works.One Item per call
Multiple Items per call
Personally I prefer the multiple items per call approach.
Finally I suspect
add_test_metadatahas a similar issue but I havent tested it yet. Just looking at the source I believe it should betest.metadatasand nottest.metadata_objectsand similar with the missing key parameter to the TestMetadata constructor.@vmalloc If i submit fixes will they be taken? It seems like development has really slowed down.