Skip to content
Snippets Groups Projects
Commit 41fffd9a authored by Swen Vermeul's avatar Swen Vermeul
Browse files

Merge branch 'release/pybis-1.31.5'

parents 7f2a070e 43cf83a5
No related branches found
Tags pybis-1.31.5
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
## Changes with pybis-1.31.5
- optimised error generation without assert
## Changes with pybis-1.31.4
- fix another exception when saving a sample with custom code
......
name = "pybis"
__author__ = "Swen Vermeul"
__email__ = "swen@ethz.ch"
__version__ = "1.31.4"
__version__ = "1.31.5"
from . import pybis
from .pybis import DataSet
......
......@@ -243,21 +243,22 @@ class Sample(OpenBisObject, entity="sample", single_item_method_name="get_sample
}
resp = self.openbis._post_request(self.openbis.reg_v1, request)
try:
assert resp["rows"][0][0]["value"] == "OK"
if resp["rows"][0][0]["value"] != "OK":
raise ValueError("Status is not OK")
if VERBOSE:
print("{} successfully created.".format(self.entity))
permId = permid = resp["rows"][0][2]["value"]
new_entity_data = self.openbis.get_sample(permId, only_data=True)
self._set_data(new_entity_data)
return self
except Exception as e:
except Exception as exc:
errmsg = f"Could not create {self.entity}"
try:
errmsg = resp["rows"][0][1]["value"]
errmsg = errmsg.split("\n")[0].split("UserFailureException: ")[1]
except IndexError:
pass
raise ValueError(errmsg)
raise ValueError(errmsg) from exc
else:
super().save()
......@@ -13,7 +13,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setup(
name="PyBIS",
version="1.31.4",
version="1.31.5",
author="Swen Vermeul • ID SIS • ETH Zürich",
author_email="swen@ethz.ch",
description="openBIS connection and interaction, optimized for using with Jupyter",
......
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