Open will-moore opened 7 years ago
Thanks @will-moore @waxenegger and definitely :+1: for handling these exceptions instead of throwing. Two comments:
None
in the DB ? I thought this would not be allowed when inserting the entry@sbesson Personally I haven't experienced the None Shape szenario, I only encountered the Mask situation.
Looking at the db I can see how a roi table entry might have no shape (empty/deleted shapes) but any row in the shape table has to have a roi id (NOT NULL). I mean there are plenty of columns that could be NULL. If anything I could only imagine that some query semantics turns a row into a NULL based on some other factor/NULL perhaps. But that's mere speculation, haven't done any code research to that end.
is it possible for a Shape to be None in the DB ? I thought this would not be allowed when inserting the entry
In OMERO if someone inserts a null in the ordered roi.shapes
list then it is possible (if very unlikely) to get a null
.
As I've found myself and reported by @waxenegger, if you have a DB where shapes are None or Masks, then
self.ctx.get_encoder(shape.__class__)
returns None and you get an exception.https://github.com/openmicroscopy/openmicroscopy/pull/5231#issuecomment-291777836
We can ignore this by simply checking whether we have an encoder:
but I wonder if we want to indicate that some Shapes in the sequence are None / Masks, with an appropriate placeholder?
In webgateway/views.py
get_rois_json()
which is used for current viewer ROIs/Shapes, we have a None check for shapes: