From f5a283d1628088efa3db3d713e3f4fff8594b125 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 22 Dec 2014 15:40:23 +0100 Subject: [PATCH] fix default grapher size, add robots.txt file --- example/sandbox/robots.txt | 5 +++++ example/sandbox/settings.py | 2 +- example/sandbox/urls.py | 5 +++++ telemeta/urls.py | 3 +++ telemeta/views/item.py | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 example/sandbox/robots.txt diff --git a/example/sandbox/robots.txt b/example/sandbox/robots.txt new file mode 100644 index 00000000..995386ae --- /dev/null +++ b/example/sandbox/robots.txt @@ -0,0 +1,5 @@ +User-agent: * +Disallow: /*/download/*$ +Disallow: /*/visualize/*$ +Disallow: /*/analyze/*$ + diff --git a/example/sandbox/settings.py b/example/sandbox/settings.py index 097d4a71..1d8ea08b 100644 --- a/example/sandbox/settings.py +++ b/example/sandbox/settings.py @@ -192,7 +192,7 @@ EMAIL_HOST = 'localhost' DEFAULT_FROM_EMAIL = 'webmaster@parisson.com' TIMESIDE_DEFAULT_GRAPHER_ID = 'waveform_centroid' -TIMESIDE_DEFAULT_WAVEFORM_SIZES = ['360x130', '640x130'] +TIMESIDE_DEFAULT_WAVEFORM_SIZES = ['346x130', '640x130'] TIMESIDE_AUTO_ZOOM = False # Settings for django-bootstrap3 diff --git a/example/sandbox/urls.py b/example/sandbox/urls.py index f812ecf2..376539be 100644 --- a/example/sandbox/urls.py +++ b/example/sandbox/urls.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- from django.conf.urls import patterns, url, include +from django.http import HttpResponse # Uncomment the next two lines to enable the admin: from django.contrib import admin @@ -9,6 +10,8 @@ js_info_dict = { 'packages': ('telemeta',), } +robots_file = open('robots.txt', 'r') + urlpatterns = patterns('', # Example: # (r'^sandbox/', include('sandbox.foo.urls')), @@ -27,4 +30,6 @@ urlpatterns = patterns('', # Languages (r'^i18n/', include('django.conf.urls.i18n')), (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), + (r'^robots\.txt$', lambda r: HttpResponse(robots_file.read(), mimetype="text/plain")), + ) diff --git a/telemeta/urls.py b/telemeta/urls.py index cc16baff..97654689 100644 --- a/telemeta/urls.py +++ b/telemeta/urls.py @@ -228,6 +228,7 @@ urlpatterns = patterns('', ) + if settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS: import debug_toolbar urlpatterns += patterns('', @@ -235,3 +236,5 @@ if settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS: # for the graphical browser/web console only, omissible url(r'json/browse/', 'jsonrpc.views.browse', name="jsonrpc_browser"), + + (r'^robots\.txt$', lambda r: HttpResponse(robots_file.read(), mimetype="text/plain")), \ No newline at end of file diff --git a/telemeta/views/item.py b/telemeta/views/item.py index bd2c408b..bc900c6d 100644 --- a/telemeta/views/item.py +++ b/telemeta/views/item.py @@ -51,7 +51,7 @@ class ItemBaseMixin(object): export_enabled = getattr(settings, 'TELEMETA_DOWNLOAD_ENABLED', True) export_formats = getattr(settings, 'TELEMETA_DOWNLOAD_FORMATS', ('mp3', 'wav')) default_grapher_id = getattr(settings, 'TIMESIDE_DEFAULT_GRAPHER_ID', ('waveform_simple')) - default_grapher_sizes = getattr(settings, 'TIMESIDE_DEFAULT_GRAPHER_SIZES', ['360x130', ]) + default_grapher_sizes = getattr(settings, 'TIMESIDE_DEFAULT_GRAPHER_SIZES', ['346x130', ]) auto_zoom = getattr(settings, 'TIMESIDE_AUTO_ZOOM', False) -- 2.39.5