diff --git a/runtests.py b/runtests.py index 17319cee91..9030242a8f 100755 --- a/runtests.py +++ b/runtests.py @@ -1,5 +1,7 @@ #!/usr/bin/env python -import sys, os, shutil +import sys +import os +import shutil from django.conf import settings, global_settings from django.core.management import execute_from_command_line @@ -19,7 +21,7 @@ if not settings.configured: ROOT_URLCONF='wagtail.tests.urls', STATIC_URL='/static/', STATIC_ROOT=STATIC_ROOT, - STATICFILES_FINDERS = ( + STATICFILES_FINDERS=( 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'compressor.finders.CompressorFinder', ), @@ -72,4 +74,3 @@ def runtests(): if __name__ == '__main__': runtests() - diff --git a/wagtail/wagtailcore/whitelist.py b/wagtail/wagtailcore/whitelist.py index f2eba727b4..508682cda2 100644 --- a/wagtail/wagtailcore/whitelist.py +++ b/wagtail/wagtailcore/whitelist.py @@ -10,7 +10,8 @@ ALLOWED_URL_SCHEMES = ['', 'http', 'https', 'ftp', 'mailto', 'tel'] def check_url(url_string): - # TODO: more paranoid checks (urlparse doesn't catch "jav\tascript:alert('XSS')") + # TODO: more paranoid checks (urlparse doesn't catch + # "jav\tascript:alert('XSS')") url = urlparse(url_string) return (url_string if url.scheme in ALLOWED_URL_SCHEMES else None) diff --git a/wagtail/wagtaildocs/migrations/0001_initial.py b/wagtail/wagtaildocs/migrations/0001_initial.py index 0360386814..569a200c7e 100644 --- a/wagtail/wagtaildocs/migrations/0001_initial.py +++ b/wagtail/wagtaildocs/migrations/0001_initial.py @@ -17,17 +17,17 @@ class Migration(SchemaMigration): (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('title', self.gf('django.db.models.fields.CharField')(max_length=255)), ('file', self.gf('django.db.models.fields.files.FileField')(max_length=100)), - ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('uploaded_by_user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), + ('created_at', self.gf('django.db.models.fields.DateTimeField') + (auto_now_add=True, blank=True)), + ('uploaded_by_user', self.gf('django.db.models.fields.related.ForeignKey') + (to=orm['auth.User'], null=True, blank=True)), )) db.send_create_signal(u'wagtaildocs', ['Document']) - def backwards(self, orm): # Deleting model 'Document' db.delete_table(u'wagtaildocs_document') - models = { u'auth.group': { 'Meta': {'object_name': 'Group'}, @@ -75,4 +75,4 @@ class Migration(SchemaMigration): } } - complete_apps = ['wagtaildocs'] \ No newline at end of file + complete_apps = ['wagtaildocs'] diff --git a/wagtail/wagtailembeds/migrations/0001_initial.py b/wagtail/wagtailembeds/migrations/0001_initial.py index 48fa506e0e..7f782a3b52 100644 --- a/wagtail/wagtailembeds/migrations/0001_initial.py +++ b/wagtail/wagtailembeds/migrations/0001_initial.py @@ -16,21 +16,25 @@ class Migration(SchemaMigration): db.create_table(u'wagtailembeds_embed', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('url', self.gf('django.db.models.fields.URLField')(max_length=200)), - ('max_width', self.gf('django.db.models.fields.SmallIntegerField')(null=True, blank=True)), + ('max_width', self.gf('django.db.models.fields.SmallIntegerField') + (null=True, blank=True)), ('type', self.gf('django.db.models.fields.CharField')(max_length=10)), ('html', self.gf('django.db.models.fields.TextField')(blank=True)), ('title', self.gf('django.db.models.fields.TextField')(blank=True)), - ('thumbnail_url', self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True)), - ('width', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), - ('height', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), - ('last_updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), + ('thumbnail_url', self.gf('django.db.models.fields.URLField') + (max_length=200, null=True, blank=True)), + ('width', self.gf('django.db.models.fields.IntegerField') + (null=True, blank=True)), + ('height', self.gf('django.db.models.fields.IntegerField') + (null=True, blank=True)), + ('last_updated', self.gf('django.db.models.fields.DateTimeField') + (auto_now=True, blank=True)), )) db.send_create_signal(u'wagtailembeds', ['Embed']) # Adding unique constraint on 'Embed', fields ['url', 'max_width'] db.create_unique(u'wagtailembeds_embed', ['url', 'max_width']) - def backwards(self, orm): # Removing unique constraint on 'Embed', fields ['url', 'max_width'] db.delete_unique(u'wagtailembeds_embed', ['url', 'max_width']) @@ -38,7 +42,6 @@ class Migration(SchemaMigration): # Deleting model 'Embed' db.delete_table(u'wagtailembeds_embed') - models = { u'wagtailembeds.embed': { 'Meta': {'unique_together': "(('url', 'max_width'),)", 'object_name': 'Embed'}, @@ -55,4 +58,4 @@ class Migration(SchemaMigration): } } - complete_apps = ['wagtailembeds'] \ No newline at end of file + complete_apps = ['wagtailembeds'] diff --git a/wagtail/wagtailimages/migrations/0001_initial.py b/wagtail/wagtailimages/migrations/0001_initial.py index 49d0f4a2c6..cf502fc697 100644 --- a/wagtail/wagtailimages/migrations/0001_initial.py +++ b/wagtail/wagtailimages/migrations/0001_initial.py @@ -19,33 +19,37 @@ class Migration(SchemaMigration): ('file', self.gf('django.db.models.fields.files.ImageField')(max_length=100)), ('width', self.gf('django.db.models.fields.IntegerField')()), ('height', self.gf('django.db.models.fields.IntegerField')()), - ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('uploaded_by_user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), + ('created_at', self.gf('django.db.models.fields.DateTimeField') + (auto_now_add=True, blank=True)), + ('uploaded_by_user', self.gf('django.db.models.fields.related.ForeignKey') + (to=orm['auth.User'], null=True, blank=True)), )) db.send_create_signal(u'wagtailimages', ['Image']) # Adding model 'Filter' db.create_table(u'wagtailimages_filter', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('spec', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)), + ('spec', self.gf('django.db.models.fields.CharField') + (max_length=255, db_index=True)), )) db.send_create_signal(u'wagtailimages', ['Filter']) # Adding model 'Rendition' db.create_table(u'wagtailimages_rendition', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('filter', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['wagtailimages.Filter'])), + ('filter', self.gf('django.db.models.fields.related.ForeignKey') + (related_name='+', to=orm['wagtailimages.Filter'])), ('file', self.gf('django.db.models.fields.files.ImageField')(max_length=100)), ('width', self.gf('django.db.models.fields.IntegerField')()), ('height', self.gf('django.db.models.fields.IntegerField')()), - ('image', self.gf('django.db.models.fields.related.ForeignKey')(related_name='renditions', to=orm['wagtailimages.Image'])), + ('image', self.gf('django.db.models.fields.related.ForeignKey') + (related_name='renditions', to=orm['wagtailimages.Image'])), )) db.send_create_signal(u'wagtailimages', ['Rendition']) # Adding unique constraint on 'Rendition', fields ['image', 'filter'] db.create_unique(u'wagtailimages_rendition', ['image_id', 'filter_id']) - def backwards(self, orm): # Removing unique constraint on 'Rendition', fields ['image', 'filter'] db.delete_unique(u'wagtailimages_rendition', ['image_id', 'filter_id']) @@ -59,7 +63,6 @@ class Migration(SchemaMigration): # Deleting model 'Rendition' db.delete_table(u'wagtailimages_rendition') - models = { u'auth.group': { 'Meta': {'object_name': 'Group'}, @@ -123,4 +126,4 @@ class Migration(SchemaMigration): } } - complete_apps = ['wagtailimages'] \ No newline at end of file + complete_apps = ['wagtailimages'] diff --git a/wagtail/wagtailredirects/migrations/0001_initial.py b/wagtail/wagtailredirects/migrations/0001_initial.py index 87af135e37..6333e27cae 100644 --- a/wagtail/wagtailredirects/migrations/0001_initial.py +++ b/wagtail/wagtailredirects/migrations/0001_initial.py @@ -15,20 +15,22 @@ class Migration(SchemaMigration): # Adding model 'Redirect' db.create_table(u'wagtailredirects_redirect', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('old_path', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255, db_index=True)), - ('site', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='redirects', null=True, to=orm['wagtailcore.Site'])), + ('old_path', self.gf('django.db.models.fields.CharField') + (unique=True, max_length=255, db_index=True)), + ('site', self.gf('django.db.models.fields.related.ForeignKey') + (blank=True, related_name='redirects', null=True, to=orm['wagtailcore.Site'])), ('is_permanent', self.gf('django.db.models.fields.BooleanField')(default=True)), - ('redirect_page', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='+', null=True, to=orm['wagtailcore.Page'])), - ('redirect_link', self.gf('django.db.models.fields.URLField')(max_length=200, blank=True)), + ('redirect_page', self.gf('django.db.models.fields.related.ForeignKey') + (blank=True, related_name='+', null=True, to=orm['wagtailcore.Page'])), + ('redirect_link', self.gf('django.db.models.fields.URLField') + (max_length=200, blank=True)), )) db.send_create_signal(u'wagtailredirects', ['Redirect']) - def backwards(self, orm): # Deleting model 'Redirect' db.delete_table(u'wagtailredirects_redirect') - models = { u'contenttypes.contenttype': { 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, @@ -84,4 +86,4 @@ class Migration(SchemaMigration): } } - complete_apps = ['wagtailredirects'] \ No newline at end of file + complete_apps = ['wagtailredirects'] diff --git a/wagtail/wagtailsearch/backends/__init__.py b/wagtail/wagtailsearch/backends/__init__.py index b1b991066b..adc492adac 100644 --- a/wagtail/wagtailsearch/backends/__init__.py +++ b/wagtail/wagtailsearch/backends/__init__.py @@ -10,7 +10,8 @@ from base import InvalidSearchBackendError # Pinched from django 1.7 source code. -# TODO: Replace this with "from django.utils.module_loading import import_string" when django 1.7 is released +# TODO: Replace this with "from django.utils.module_loading import import_string" +# when django 1.7 is released def import_string(dotted_path): """ Import a dotted module path and return the attribute/class designated by the @@ -32,7 +33,6 @@ def import_string(dotted_path): six.reraise(ImportError, ImportError(msg), sys.exc_info()[2]) - def get_search_backend(backend='default', **kwargs): # Get configuration default_conf = { @@ -40,7 +40,8 @@ def get_search_backend(backend='default', **kwargs): 'BACKEND': 'wagtail.wagtailsearch.backends.db.DBSearch', }, } - WAGTAILSEARCH_BACKENDS = getattr(settings, 'WAGTAILSEARCH_BACKENDS', default_conf) + WAGTAILSEARCH_BACKENDS = getattr( + settings, 'WAGTAILSEARCH_BACKENDS', default_conf) # Try to find the backend try: @@ -68,4 +69,4 @@ def get_search_backend(backend='default', **kwargs): backend, e)) # Create backend - return backend_cls(params) \ No newline at end of file + return backend_cls(params) diff --git a/wagtail/wagtailsearch/migrations/0001_initial.py b/wagtail/wagtailsearch/migrations/0001_initial.py index b6676a92ef..1eaacd6b69 100644 --- a/wagtail/wagtailsearch/migrations/0001_initial.py +++ b/wagtail/wagtailsearch/migrations/0001_initial.py @@ -15,28 +15,34 @@ class Migration(SchemaMigration): # Adding model 'Query' db.create_table(u'wagtailsearch_query', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('query_string', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), + ('query_string', self.gf('django.db.models.fields.CharField') + (unique=True, max_length=255)), )) db.send_create_signal(u'wagtailsearch', ['Query']) # Adding model 'QueryDailyHits' db.create_table(u'wagtailsearch_querydailyhits', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('query', self.gf('django.db.models.fields.related.ForeignKey')(related_name='daily_hits', to=orm['wagtailsearch.Query'])), + ('query', self.gf('django.db.models.fields.related.ForeignKey') + (related_name='daily_hits', to=orm['wagtailsearch.Query'])), ('date', self.gf('django.db.models.fields.DateField')()), ('hits', self.gf('django.db.models.fields.IntegerField')(default=0)), )) db.send_create_signal(u'wagtailsearch', ['QueryDailyHits']) - # Adding unique constraint on 'QueryDailyHits', fields ['query', 'date'] + # Adding unique constraint on 'QueryDailyHits', fields ['query', + # 'date'] db.create_unique(u'wagtailsearch_querydailyhits', ['query_id', 'date']) # Adding model 'EditorsPick' db.create_table(u'wagtailsearch_editorspick', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('query', self.gf('django.db.models.fields.related.ForeignKey')(related_name='editors_picks', to=orm['wagtailsearch.Query'])), - ('page', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['wagtailcore.Page'])), - ('sort_order', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('query', self.gf('django.db.models.fields.related.ForeignKey') + (related_name='editors_picks', to=orm['wagtailsearch.Query'])), + ('page', self.gf('django.db.models.fields.related.ForeignKey') + (to=orm['wagtailcore.Page'])), + ('sort_order', self.gf('django.db.models.fields.IntegerField') + (null=True, blank=True)), ('description', self.gf('django.db.models.fields.TextField')(blank=True)), )) db.send_create_signal(u'wagtailsearch', ['EditorsPick']) @@ -51,13 +57,16 @@ class Migration(SchemaMigration): # Adding model 'SearchTestChild' db.create_table(u'wagtailsearch_searchtestchild', ( - (u'searchtest_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['wagtailsearch.SearchTest'], unique=True, primary_key=True)), + (u'searchtest_ptr', self.gf('django.db.models.fields.related.OneToOneField') + (to=orm[ + 'wagtailsearch.SearchTest'], unique=True, primary_key=True)), ('extra_content', self.gf('django.db.models.fields.TextField')()), )) db.send_create_signal(u'wagtailsearch', ['SearchTestChild']) def backwards(self, orm): - # Removing unique constraint on 'QueryDailyHits', fields ['query', 'date'] + # Removing unique constraint on 'QueryDailyHits', fields ['query', + # 'date'] db.delete_unique(u'wagtailsearch_querydailyhits', ['query_id', 'date']) # Deleting model 'Query'