contrib.sitemaps doesn't support RequestSite
|Reported by:||Arthur Koziel||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The contrib.sitemaps app will always query the database for a Site object. It doesn't support RequestSite objects (http://docs.djangoproject.com/en/dev/ref/contrib/sites/#requestsite-objects).
The attached patch solves this issue. However, it is pretty hard to test this because the runtests.py has 'django.contrib.sites' in ALWAYS_INSTALLED_APPS, so checking if the app is installed with:
if Site._meta.installed: current_site = Site.objects.get_current() else: current_site = RequestSite(request)
won't work because the tests will always assume that the app is installed and query the database.