You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 28, 2021. It is now read-only.
Currently data adapters use hasattr() to check for the existence of attributes on the persistent object, however hasattr fails if any Exception is thrown in the property/attribute.
This makes debugging difficult as it can hide errors in properties by treating them as non-existent attributes instead of throwing the correct exception.
An alternative approach would be to use something like the following, explicitly checking for AttributeError:
This error is also present in the SQLAlchemy data adapter where it hides any DetachedInstanceError exceptions that are thrown when trying to access out of session objects.
The text was updated successfully, but these errors were encountered:
does not work for platforms like AppEngine because NDB raises this exception if the property wasn't set for a particular object. This does not allow us to distinguish between a non existent properties vs not set properties.
SQLAlchemy might deal with it differently and it might be a per adapter solution
Currently data adapters use hasattr() to check for the existence of attributes on the persistent object, however hasattr fails if any Exception is thrown in the property/attribute.
This makes debugging difficult as it can hide errors in properties by treating them as non-existent attributes instead of throwing the correct exception.
An alternative approach would be to use something like the following, explicitly checking for AttributeError:
try:
getattr(someObject, 'someProperty')
except AttributeError:
print "Doesn't exist"
else
print "Exists"
This error is also present in the SQLAlchemy data adapter where it hides any DetachedInstanceError exceptions that are thrown when trying to access out of session objects.
The text was updated successfully, but these errors were encountered: