Import problem starting with r12977

9 views
Skip to first unread message

Erik Stein

unread,
Apr 16, 2010, 12:55:15 PM4/16/10
to django-d...@googlegroups.com

Hello --

I hope that's the correct place to ask, else point me to django-users.

Starting with changeset

http://code.djangoproject.com/changeset/12977 (Fixed #13328 -- Added a getstate/setstate pair to fields so that callable default values aren't pickled. Thanks to bkonkle for the report, and Vitaly Babiy for the patch.)

I get import errors which are very difficult to debug (at least for me). I'm hangling from file to file. It seems to boil down to

self.model = cls

in fields/__init__.py.

It may be related to some non-obvious circular import on my side, but what exactly am I supposed to do concerning r12977? File a new bug or just try to fix my code?

best
-- erik



Erik Stein
Programmierung, Grafik
Oranienstr. 32 10999 Berlin, Germany
fon +49 30 69201880 fax +49 30 692018809
email er...@classlibrary.net





Erik Stein
Programmierung, Grafik
Oranienstr. 32 10999 Berlin, Germany
fon +49 30 69201880 fax +49 30 692018809
email er...@classlibrary.net



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

Derek Hoy

unread,
Apr 16, 2010, 7:36:39 PM4/16/10
to django-d...@googlegroups.com
Strange, I had the same problem and rolling back to 12976 fixed it.
But another project still failed. It worked when I rolled back to
r12949.

http://code.djangoproject.com/changeset/12950 is the first of a few
that deal with app loading. It may be our projects had import errors
that weren't being reported I suppose.

I'll dig around a bit more.

Derek

Derek Hoy

unread,
Apr 16, 2010, 8:09:50 PM4/16/10
to django-d...@googlegroups.com
On Sat, Apr 17, 2010 at 12:36 AM, Derek Hoy <dere...@gmail.com> wrote:
>
> I'll dig around a bit more.

The problems seemed to come from the same models.py that was shared
across the projects. I moved a couple of imports and it seems fine
with trunk (r12996).

So it looks like it's the change in the error handling that is showing
up problems in the code.

And that means we should be in django-users :)

Derek

Erik Stein

unread,
Apr 17, 2010, 3:38:16 AM4/17/10
to django-d...@googlegroups.com

I'm was digging around more, too, and finally i've set up a small test environment with django (r12955), just an project with a single app:

django-admin.py startproject mytest
cd mytest
django-admin.py startapp blog


INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.comments', # <-- Added comments app
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'blog',
)

blog/models.py:

from django.db import models
from django.contrib.comments.models import Comment


c-y:mytest erik$ ./manage.py validate
Error: cannot import name Comment

I'd would definetly consider this a bug in django, but I've no idea how to design a regression test for this, sorry. I'll try to understand what these app loading changes do.

greetings
-- erik

Ramiro Morales

unread,
Apr 17, 2010, 8:33:11 AM4/17/10
to django-d...@googlegroups.com
On Sat, Apr 17, 2010 at 4:38 AM, Erik Stein <co...@classlibrary.net> wrote:
>
> I'm was digging around more, too, and finally i've set up a small test environment with django (r12955), just an project with a single app:

You meant r12995 here, right?

>
> django-admin.py startproject mytest
> cd mytest
> django-admin.py startapp blog
>
>
> INSTALLED_APPS = (
>    'django.contrib.auth',
>    'django.contrib.comments', # <-- Added comments app
>    'django.contrib.contenttypes',
>    'django.contrib.sessions',
>    'django.contrib.sites',
>    'django.contrib.messages',
>    'blog',
> )
>
> blog/models.py:
>
>        from django.db import models
>        from django.contrib.comments.models import Comment
>
>
> c-y:mytest erik$ ./manage.py validate
> Error: cannot import name Comment
>
> I'd would definetly consider this a bug in django, but I've no idea how to design a regression test for this, sorry. I'll try to understand what these app loading changes do.

I think this has already been reported in ticket 13366, Comment is a
model that inherits from an abstract base class that has fields
(BaseCommentAbstractModel).

--
Ramiro Morales | http://rmorales.net

Erik Stein

unread,
Apr 19, 2010, 6:09:16 AM4/19/10
to django-d...@googlegroups.com

thanks for pointing this out.

I attached a symptomatic patch to ticket #13366.

best
-- erik


Am 17.04.2010 um 14:33 schrieb Ramiro Morales:

> On Sat, Apr 17, 2010 at 4:38 AM, Erik Stein <co...@classlibrary.net> wrote:
>> I'd would definetly consider this a bug in django, but I've no idea how to design a regression test for this, sorry. I'll try to understand what these app loading changes do.
>
> I think this has already been reported in ticket 13366, Comment is a
> model that inherits from an abstract base class that has fields
> (BaseCommentAbstractModel).

--
Reply all
Reply to author
Forward
0 new messages