diff --git a/ivatar/ivataraccount/models.py b/ivatar/ivataraccount/models.py index e4fc338..64a2265 100644 --- a/ivatar/ivataraccount/models.py +++ b/ivatar/ivataraccount/models.py @@ -180,7 +180,7 @@ class Photo(BaseAccountModel): # Testing? Ideas anyone? except Exception as exc: # pylint: disable=broad-except # For debugging only - print('Exception caught: %s' % exc) + print('Exception caught in Photo.save(): %s' % exc) return False self.format = file_format(img.format) if not self.format: diff --git a/ivatar/ivataraccount/test_views.py b/ivatar/ivataraccount/test_views.py index 057db68..ddb3906 100644 --- a/ivatar/ivataraccount/test_views.py +++ b/ivatar/ivataraccount/test_views.py @@ -1225,10 +1225,12 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods ) ) url = '%s?%s' % (urlobj.path, urlobj.query) - response = self.client.get(url, follow=True) + response = self.client.get(url, follow=False) self.assertRedirects( response=response, expected_url='/gravatarproxy/1b1d0b654430c012e47e350db07c83c5?s=80&default=mm', + status_code=302, + target_status_code=200, msg_prefix='Why does this not redirect to the gravatarproxy and defaulting to mm?') # Eventually one should check if the data is the same diff --git a/ivatar/urls.py b/ivatar/urls.py index 618890a..39d44db 100644 --- a/ivatar/urls.py +++ b/ivatar/urls.py @@ -13,7 +13,6 @@ urlpatterns = [ # pylint: disable=invalid-name path('admin/', admin.site.urls), path('i18n/', include('django.conf.urls.i18n')), url('openid/', include('django_openid_auth.urls')), - url('accounts/', include('ivatar.ivataraccount.urls')), url('tools/', include('ivatar.tools.urls')), url( r'avatar/(?P\w{64})', @@ -36,7 +35,21 @@ urlpatterns = [ # pylint: disable=invalid-name url('privacy/', TemplateView.as_view(template_name='privacy.html'), name='privacy'), url('contact/', TemplateView.as_view(template_name='contact.html'), name='contact'), path('talk_to_us/', RedirectView.as_view(url='/contact'), name='talk_to_us'), - url('', TemplateView.as_view(template_name='home.html'), name='home'), ] +MAINTENANCE = False +try: + if settings.MAINTENANCE: + MAINTENANCE = True +except: + pass + +if MAINTENANCE: + urlpatterns.append(url('', TemplateView.as_view(template_name='maintenance.html'), name='home')) + urlpatterns.insert(3, url('accounts/', RedirectView.as_view(url='/'))) +else: + urlpatterns.append(url('', TemplateView.as_view(template_name='home.html'), name='home')) + urlpatterns.insert(3, url('accounts/', include('ivatar.ivataraccount.urls'))) + + urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/templates/maintenance.html b/templates/maintenance.html new file mode 100644 index 0000000..47e3dfa --- /dev/null +++ b/templates/maintenance.html @@ -0,0 +1,30 @@ +{% extends 'base_home.html' %} +{% load i18n %} +{% load static %} + +{% block title %}{% trans 'federated avatar hosting service' %}{% endblock %} + +{% block content %} + +
+
+
+

{{ site_name }}

+

{% trans 'freeing the web one face at a time' %}

+
+
+
+
+
+
+

{% trans 'Maintenance mode' %}

+ Libravatar is currently in maintenance mode.
+ Avatars are still served, but all write operations may result + in loss of these changes. +

+
+
+
+
+ +{% endblock %}