Don't call `static()` when constructing HalloPlugins

This isn't necessary, since Django form media fills in static paths itself - and doing it at module level will break on startup with certain staticfiles configurations if collectstatic hasn't run yet. Fixes #3829
pull/3840/merge
Matt Westcott 2017-09-07 12:36:50 +01:00
rodzic 90ce50307e
commit 92b4f68c67
9 zmienionych plików z 14 dodań i 15 usunięć

Wyświetl plik

@ -19,7 +19,8 @@ Changelog
1.12.2 (xx.xx.xxxx) - IN DEVELOPMENT 1.12.2 (xx.xx.xxxx) - IN DEVELOPMENT
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
* Fix: Migration for addition of ``Page.draft_title`` field is now reversible (Venelin Stoykov) * Fix: Migration for addition of `Page.draft_title` field is now reversible (Venelin Stoykov)
* Fix: Fixed failure on application startup when `ManifestStaticFilesStorage` is in use and `collectstatic` has not yet been run (Matt Westcott)
1.12.1 (30.08.2017) 1.12.1 (30.08.2017)

Wyświetl plik

@ -105,7 +105,7 @@ Once the plugin has been created, it should be registered as a rich text feature
'hallo', 'blockquote', 'hallo', 'blockquote',
HalloPlugin( HalloPlugin(
name='halloblockquote', name='halloblockquote',
js=[static('myapp/js/hallo-blockquote.js')], js=['myapp/js/hallo-blockquote.js'],
) )
) )

Wyświetl plik

@ -14,3 +14,4 @@ Bug fixes
~~~~~~~~~ ~~~~~~~~~
* Migration for addition of ``Page.draft_title`` field is now reversible (Venelin Stoykov) * Migration for addition of ``Page.draft_title`` field is now reversible (Venelin Stoykov)
* Fixed failure on application startup when ``ManifestStaticFilesStorage`` is in use and ``collectstatic`` has not yet been run (Matt Westcott)

Wyświetl plik

@ -99,7 +99,7 @@ def register_blockquote_feature(features):
features.register_editor_plugin( features.register_editor_plugin(
'hallo', 'blockquote', HalloPlugin( 'hallo', 'blockquote', HalloPlugin(
name='halloblockquote', name='halloblockquote',
js=[static('testapp/js/hallo-blockquote.js')], js=['testapp/js/hallo-blockquote.js'],
css={'all': [static('testapp/css/hallo-blockquote.css')]}, css={'all': ['testapp/css/hallo-blockquote.css']},
) )
) )

Wyświetl plik

@ -4,7 +4,6 @@ import json
from collections import OrderedDict from collections import OrderedDict
from django.conf import settings from django.conf import settings
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.forms import Media, widgets from django.forms import Media, widgets
from django.utils.module_loading import import_string from django.utils.module_loading import import_string
@ -74,7 +73,7 @@ class HalloListPlugin(HalloPlugin):
CORE_HALLO_PLUGINS = [ CORE_HALLO_PLUGINS = [
HalloPlugin(name='halloreundo', order=50), HalloPlugin(name='halloreundo', order=50),
HalloPlugin(name='hallorequireparagraphs', js=[ HalloPlugin(name='hallorequireparagraphs', js=[
static('wagtailadmin/js/hallo-plugins/hallo-requireparagraphs.js'), 'wagtailadmin/js/hallo-plugins/hallo-requireparagraphs.js',
]), ]),
HalloHeadingPlugin(element='p') HalloHeadingPlugin(element='p')
] ]
@ -143,8 +142,8 @@ class HalloRichTextArea(WidgetWithScript, widgets.Textarea):
@property @property
def media(self): def media(self):
media = Media(js=[ media = Media(js=[
static('wagtailadmin/js/vendor/hallo.js'), 'wagtailadmin/js/vendor/hallo.js',
static('wagtailadmin/js/hallo-bootstrap.js'), 'wagtailadmin/js/hallo-bootstrap.js',
]) ])
for plugin in self.plugins: for plugin in self.plugins:

Wyświetl plik

@ -1,7 +1,6 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@ -189,7 +188,7 @@ def register_core_features(features):
'hallo', 'hr', 'hallo', 'hr',
HalloPlugin( HalloPlugin(
name='hallohr', name='hallohr',
js=[static('wagtailadmin/js/hallo-plugins/hallo-hr.js')], js=['wagtailadmin/js/hallo-plugins/hallo-hr.js'],
order=45, order=45,
) )
) )
@ -199,7 +198,7 @@ def register_core_features(features):
'hallo', 'link', 'hallo', 'link',
HalloPlugin( HalloPlugin(
name='hallowagtaillink', name='hallowagtaillink',
js=[static('wagtailadmin/js/hallo-plugins/hallo-wagtaillink.js')], js=['wagtailadmin/js/hallo-plugins/hallo-wagtaillink.js'],
) )
) )
features.default_features.append('link') features.default_features.append('link')

Wyświetl plik

@ -80,7 +80,7 @@ def register_embed_feature(features):
'hallo', 'document-link', 'hallo', 'document-link',
HalloPlugin( HalloPlugin(
name='hallowagtaildoclink', name='hallowagtaildoclink',
js=[static('wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js')], js=['wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js'],
) )
) )
features.default_features.append('document-link') features.default_features.append('document-link')

Wyświetl plik

@ -1,7 +1,6 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from django.conf.urls import include, url from django.conf.urls import include, url
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.core import urlresolvers from django.core import urlresolvers
from django.utils.html import format_html from django.utils.html import format_html
@ -37,7 +36,7 @@ def register_embed_feature(features):
'hallo', 'embed', 'hallo', 'embed',
HalloPlugin( HalloPlugin(
name='hallowagtailembeds', name='hallowagtailembeds',
js=[static('wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js')], js=['wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js'],
) )
) )
features.default_features.append('embed') features.default_features.append('embed')

Wyświetl plik

@ -72,7 +72,7 @@ def register_image_feature(features):
'hallo', 'image', 'hallo', 'image',
HalloPlugin( HalloPlugin(
name='hallowagtailimage', name='hallowagtailimage',
js=[static('wagtailimages/js/hallo-plugins/hallo-wagtailimage.js')], js=['wagtailimages/js/hallo-plugins/hallo-wagtailimage.js'],
) )
) )
features.default_features.append('image') features.default_features.append('image')