kopia lustrzana https://github.com/wagtail/wagtail
Merge branch 'kaedroho-document-served-signal-fix'
commit
c27c509a8a
|
@ -26,6 +26,7 @@ Changelog
|
|||
* The external link chooser in rich text areas now accepts URLs of the form '/some/local/path', to allow linking to non-Wagtail-controlled URLs within the local site (Eric Drechsel)
|
||||
* SCSS files in wagtailadmin now use absolute imports, to permit overriding by user stylesheets (Martin Sanders)
|
||||
* Bare text entered in rich text areas is now automatically wrapped in a paragraph element
|
||||
* Fix: The `document_served` signal now correctly passes the Document class as `sender` and the document as `instance`
|
||||
|
||||
0.8.5 (17.02.2015)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -40,6 +40,8 @@ Minor features
|
|||
Bug fixes
|
||||
~~~~~~~~~
|
||||
|
||||
* The ``document_served`` signal now correctly passes the Document class as ``sender`` and the document as ``instance``
|
||||
|
||||
|
||||
Upgrade considerations
|
||||
======================
|
||||
|
@ -99,3 +101,8 @@ If you have added your own custom admin views to the Wagtail admin (e.g. through
|
|||
- ``wagtailsnippets/edit_handlers/snippet_chooser_panel.html``
|
||||
|
||||
All of these templates are now deprecated. Wagtail now provides a set of Django form widgets for this purpose - ``AdminPageChooser``, ``AdminDocumentChooser``, ``AdminImageChooser`` and ``AdminSnippetChooser`` - which can be used in place of the ``HiddenInput`` widget that these form fields were previously using. The field can then be rendered using the regular ``wagtailadmin/shared/field.html`` or ``wagtailadmin/shared/field_as_li.html`` template.
|
||||
|
||||
``document_served`` signal arguments have changed
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Previously, the ``document_served`` signal (which is fired whenever a user downloads a document) passed the document instance as the ``sender``. This has now been changed to correspond the behaviour of Django's built-in signals; ``sender`` is now the ``Document`` class, and the document instance is passed as the argument ``instance``. Any existing signal listeners that expect to receive the document instance in ``sender`` must now be updated to check the ``instance`` argument instead.
|
||||
|
|
|
@ -550,7 +550,8 @@ class TestServeView(TestCase):
|
|||
self.get()
|
||||
|
||||
self.assertEqual(mock_handler.call_count, 1)
|
||||
self.assertEqual(mock_handler.mock_calls[0][2]['sender'], self.document)
|
||||
self.assertEqual(mock_handler.mock_calls[0][2]['sender'], models.Document)
|
||||
self.assertEqual(mock_handler.mock_calls[0][2]['instance'], self.document)
|
||||
|
||||
def test_with_nonexistent_document(self):
|
||||
response = self.client.get(reverse('wagtaildocs_serve', args=(1000, 'blahblahblah', )))
|
||||
|
|
|
@ -16,6 +16,6 @@ def serve(request, document_id, document_filename):
|
|||
response['Content-Length'] = doc.file.size
|
||||
|
||||
# Send document_served signal
|
||||
document_served.send(sender=doc, request=request)
|
||||
document_served.send(sender=Document, instance=doc, request=request)
|
||||
|
||||
return response
|
||||
|
|
Ładowanie…
Reference in New Issue