For the discussion below, ALL the code is in .../intomec/tenq

I wrote some code in tests.py like so:

   from tenq.models import *
        self.expectedValue = Answers((1,2,3,4))

within the to_python() method of AnswersField in models.py:
    def to_python(self, _value):
        print "_value.__class__ =",_value.__class__
        if isinstance(_value, Answers):
            return _value

isinstance(_value, Answers) fails for the object created in tests.py
because the
>>>_value.__class__ = <class 'intomec.tenq.models.Answers'>
>>>_value.__class__ = <class 'tenq.models.Answers'>


when I change tests.py to
from intomec.tenq.models import *
        self.expectedValue = Answers((1,2,3,4))

I get
>>>_value.__class__ = <class 'intomec.tenq.models.Answers'>
>>>_value.__class__ = <class 'intomec.tenq.models.Answers'>
and isinstance doesn't fail.

What I can't figure out is, why do both imports work, and why do they
generate different results.  It seems to me the name of the class is
the name of the class, and either the import should fail or they
should both yield the same name.

Anyone have any ideas on why this is?  I'm not even sure why the
second from statement works, since I'm already in the intomec folder
when I run

python manage.py test

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to