kopia lustrzana https://github.com/wagtail/wagtail
PEP8 fixes from #41
rodzic
d8c0a0ef9b
commit
c9202bbd8e
|
@ -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()
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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']
|
||||
complete_apps = ['wagtaildocs']
|
||||
|
|
|
@ -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']
|
||||
complete_apps = ['wagtailembeds']
|
||||
|
|
|
@ -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']
|
||||
complete_apps = ['wagtailimages']
|
||||
|
|
|
@ -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']
|
||||
complete_apps = ['wagtailredirects']
|
||||
|
|
|
@ -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)
|
||||
return backend_cls(params)
|
||||
|
|
|
@ -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'
|
||||
|
|
Ładowanie…
Reference in New Issue