[Django] #26939: Django 1.9.8 Sitemaps is broken due to "isinstance() arg 2 must be a class, type, or tuple of classes and types"

28 views
Skip to first unread message

Django

unread,
Jul 22, 2016, 8:54:48 PM7/22/16
to django-...@googlegroups.com
#26939: Django 1.9.8 Sitemaps is broken due to "isinstance() arg 2 must be a class,
type, or tuple of classes and types"
-------------------------------+--------------------
Reporter: xuchen81 | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I am using Django version 1.9.8, and mezzanine version 4.1.0.
The following code failed:
{{{
from mezzanine.core.sitemaps import DisplayableSitemap
sitemaps = {"sitemaps": {"displayable": DisplayableSitemap, 'views':
SwiftypeSitemap}}
urlpatterns += patterns("django.contrib.sitemaps.views",
("^sitemap\.xml$", "sitemap", sitemaps))
}}}
The trace back:
{{{
TypeError at /sitemap.xml
isinstance() arg 2 must be a class, type, or tuple of classes and types
Request Method: GET
Request URL: https://xxxxxxxxxx.com:8787/sitemap.xml
Django Version: 1.9.8
Exception Type: TypeError
Exception Value:
isinstance() arg 2 must be a class, type, or tuple of classes and types
Exception Location:
/srv/xxxxxxxxxx/virtualenvs/corpsite/local/lib/python2.7/site-
packages/django/db/models/fields/related.py in get_default, line 908
Python Executable: /srv/appdynamics/virtualenvs/corpsite/bin/uwsgi
Python Version: 2.7.6
Python Path:
['.',
'',
'/srv/xxxxxxxxxx/virtualenvs/corpsite/src/supervisor',
'/srv/xxxxxxxxxx/virtualenvs/corpsite/lib/python2.7',
'/srv/xxxxxxxxxx/virtualenvs/corpsite/lib/python2.7/plat-x86_64-linux-
gnu',
'/srv/xxxxxxxxxx/virtualenvs/corpsite/lib/python2.7/lib-tk',
'/srv/xxxxxxxxxx/virtualenvs/corpsite/lib/python2.7/lib-old',
'/srv/xxxxxxxxxx/virtualenvs/corpsite/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/srv/xxxxxxxxxx/virtualenvs/corpsite/local/lib/python2.7/site-packages',
'/srv/xxxxxxxxxx/www/private']
Server time: Fri, 22 Jul 2016 17:48:22 -0700
...
...

/srv/xxxxxxxxxx/virtualenvs/corpsite/local/lib/python2.7/site-
packages/django/db/models/fields/related.py in get_default
if isinstance(field_default, self.remote_field.model): ...
▶ Local vars
Variable Value
self: <django.db.models.fields.related.ForeignKey: site>
field_default: None
}}}

The problem is here: self.remote_field.model is not a type of class, but
unicode.

--
Ticket URL: <https://code.djangoproject.com/ticket/26939>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 22, 2016, 8:57:53 PM7/22/16
to django-...@googlegroups.com
#26939: Django 1.9.8 Sitemaps is broken due to "isinstance() arg 2 must be a class,
type, or tuple of classes and types"
-------------------------------+--------------------------------------

Reporter: xuchen81 | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by xuchen81):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

New description:

I am using Django version 1.9.8, and mezzanine version 4.1.0.
The following code failed:
{{{
from mezzanine.core.sitemaps import DisplayableSitemap
sitemaps = {"sitemaps": {"displayable": DisplayableSitemap, 'views':
SwiftypeSitemap}}
urlpatterns += patterns("django.contrib.sitemaps.views",
("^sitemap\.xml$", "sitemap", sitemaps))
}}}
The trace back:
{{{
TypeError at /sitemap.xml
isinstance() arg 2 must be a class, type, or tuple of classes and types
Request Method: GET
Request URL: https://xxxxxxxxxx.com:8787/sitemap.xml
Django Version: 1.9.8
Exception Type: TypeError
Exception Value:
isinstance() arg 2 must be a class, type, or tuple of classes and types
Exception Location:
/srv/xxxxxxxxxx/virtualenvs/corpsite/local/lib/python2.7/site-
packages/django/db/models/fields/related.py in get_default, line 908

Python Executable: /srv/xxxxxxxxxx/virtualenvs/corpsite/bin/uwsgi

--

--
Ticket URL: <https://code.djangoproject.com/ticket/26939#comment:1>

Django

unread,
Jul 25, 2016, 10:50:32 AM7/25/16
to django-...@googlegroups.com
#26939: sitemaps crashes with "isinstance() arg 2 must be a class, type, or tuple
of classes and types"
----------------------------------+------------------------------------

Reporter: xuchen81 | Owner: nobody
Type: Bug | Status: new
Component: contrib.sitemaps | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by timgraham):

* stage: Unreviewed => Accepted
* component: Uncategorized => contrib.sitemaps


Old description:

> I am using Django version 1.9.8, and mezzanine version 4.1.0.
> The following code failed:
> {{{
> from mezzanine.core.sitemaps import DisplayableSitemap
> sitemaps = {"sitemaps": {"displayable": DisplayableSitemap, 'views':
> SwiftypeSitemap}}
> urlpatterns += patterns("django.contrib.sitemaps.views",
> ("^sitemap\.xml$", "sitemap", sitemaps))
> }}}
> The trace back:
> {{{
> TypeError at /sitemap.xml
> isinstance() arg 2 must be a class, type, or tuple of classes and types
> Request Method: GET
> Request URL: https://xxxxxxxxxx.com:8787/sitemap.xml
> Django Version: 1.9.8
> Exception Type: TypeError
> Exception Value:
> isinstance() arg 2 must be a class, type, or tuple of classes and types
> Exception Location:
> /srv/xxxxxxxxxx/virtualenvs/corpsite/local/lib/python2.7/site-
> packages/django/db/models/fields/related.py in get_default, line 908

> Python Executable: /srv/xxxxxxxxxx/virtualenvs/corpsite/bin/uwsgi

New description:

I am using Django version 1.9.8, and mezzanine version 4.1.0.
The following code failed:
{{{

from django.contrib.sitemaps.views import sitemap


from mezzanine.core.sitemaps import DisplayableSitemap
sitemaps = {"sitemaps": {"displayable": DisplayableSitemap}}

urlpatterns += [url("^sitemap\.xml$", sitemap, sitemaps)]


}}}
The trace back:
{{{
TypeError at /sitemap.xml
isinstance() arg 2 must be a class, type, or tuple of classes and types
Request Method: GET
Request URL: https://xxxxxxxxxx.com:8787/sitemap.xml
Django Version: 1.9.8
Exception Type: TypeError
Exception Value:
isinstance() arg 2 must be a class, type, or tuple of classes and types
Exception Location:
/srv/xxxxxxxxxx/virtualenvs/corpsite/local/lib/python2.7/site-
packages/django/db/models/fields/related.py in get_default, line 908

Python Executable: /srv/xxxxxxxxxx/virtualenvs/corpsite/bin/uwsgi

--

Comment:

Seems to be a regression in 1.9 (the sample code works in 1.8) although
I've having trouble bisecting it due to other crashes in mezzanine at
various points in Django's history. If you could create a minimal project
that reproduces the problem without mezzazine, that would be ideal as
we'll need a regression test anyway.

--
Ticket URL: <https://code.djangoproject.com/ticket/26939#comment:2>

Django

unread,
Jul 25, 2016, 1:56:48 PM7/25/16
to django-...@googlegroups.com
#26939: sitemaps crashes with "isinstance() arg 2 must be a class, type, or tuple
of classes and types"
----------------------------------+------------------------------------

Reporter: xuchen81 | Owner: nobody
Type: Bug | Status: new
Component: contrib.sitemaps | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------

Comment (by xuchen81):

I think this is a bug in mezzanine, not a django bug. We can close it
here.

--
Ticket URL: <https://code.djangoproject.com/ticket/26939#comment:3>

Django

unread,
Jul 25, 2016, 1:57:37 PM7/25/16
to django-...@googlegroups.com
#26939: sitemaps crashes with "isinstance() arg 2 must be a class, type, or tuple
of classes and types"
----------------------------------+------------------------------------
Reporter: xuchen81 | Owner: nobody
Type: Bug | Status: closed
Component: contrib.sitemaps | Version: 1.9
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by xuchen81):

* status: new => closed
* resolution: => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/26939#comment:4>

Reply all
Reply to author
Forward
0 new messages