Opened 8 years ago
Last modified 8 years ago
#26939 closed Bug
Django 1.9.8 Sitemaps is broken due to "isinstance() arg 2 must be a class, type, or tuple of classes and types" — at Initial Version
Reported by: | Chen Xu | Owned by: | nobody |
---|---|---|---|
Component: | contrib.sitemaps | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
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/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.
Note:
See TracTickets
for help on using tickets.