On Nov 8, 11:17 am, Scott Gould <zinck...@gmail.com> wrote:
> Hi folks,
>
> This is a head-scratcher to me. I occasionally get this error:
>
> ---
>   File "/var/www/myproj/account/views.py", line 54, in account
>     if request.account.is_instructor and request.account.contact and
> request.account.contact.relationship.institution_party_number:
>
> AttributeError: 'NoneType' object has no attribute 'relationship'
> ---
>
> I'm leaving out all the supporting code deliberately. My question is
> simple: if python short-circuits evaluation and
> "request.account.contact" is None, how is it even getting as far as
> "request.account.contact.relationship.institution_party_number"?
>
> Thanks!

Hard to tell without details. Maybe request.account.contact is an
impure property with side effects?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to