Error with Proxy() when remote reference returns empty result set

Bug #814212 reported by Nick Snell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Storm
New
Undecided
Unassigned

Bug Description

With storm 0.18 when using Proxy() to a Reference field, when the Reference is None the attribue access to the Proxy falls over with a seemingly random error message:

   AttributeError: "'NoneType' object has no attribute '__dict__'"

   function __get__ in references.py at line 417
       return self._remote_prop.__get__(self._reference.__get__(obj))
   function __get__ in properties.py at line 53
       return self._get_column(cls)
   function _get_column in properties.py at line 92
       column = cls.__dict__["_storm_columns"].get(self)

attached is a working example of the bug.

I don't know enough about it to submit a patch, however I believe in the __get__ in Proxy it should be first checking if the the reference object can be retrieved before proceeding. Adding this resolved the issue:

   if self._reference.__get__(obj) == None:
               return None

before the return:

   return self._remote_prop.__get__(self._reference.__get__(obj))

If I can provide anymore info please let me know.

Nick

Revision history for this message
Nick Snell (nick-xr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.