Added missing is_stored_locally() to AbstractDocument

pull/5423/head
Jonny 2019-06-25 13:40:09 +01:00 zatwierdzone przez Matt Westcott
rodzic 7a47bfc9a7
commit 851bd5f24d
4 zmienionych plików z 14 dodań i 0 usunięć
docs/releases
wagtail/documents

Wyświetl plik

@ -63,6 +63,7 @@ Changelog
* Fix: Page.copy() no longer copies child objects when the accesssor name is included in `exclude_fields_in_copy` (Karl Hobley)
* Fix: Move focus to the pages explorer menu when open (Helen Chapman)
* Fix: Clicking the privacy toggle while the page is still loading no longer loads the wrong data in the page (Helen Chapman)
* Fix: Added missing `is_stored_locally` method to `AbstractDocument` (jonny5532)
2.5.1 (07.05.2019)

Wyświetl plik

@ -380,6 +380,7 @@ Contributors
* Jordan Bauer
* Fidel Ramos
* Quadric
* jonny5532
Translators
===========

Wyświetl plik

@ -94,6 +94,7 @@ Bug fixes
* Added missing form media to user edit form template (Matt Westcott)
* ``Page.copy()`` no longer copies child objects when the accesssor name is included in ``exclude_fields_in_copy`` (Karl Hobley)
* Clicking the privacy toggle while the page is still loading no longer loads the wrong data in the page (Helen Chapman)
* Added missing ``is_stored_locally`` method to ``AbstractDocument`` (jonny5532)
Upgrade considerations

Wyświetl plik

@ -52,6 +52,17 @@ class AbstractDocument(CollectionMember, index.Indexed, models.Model):
index.FilterField('uploaded_by_user'),
]
def is_stored_locally(self):
"""
Returns True if the image is hosted on the local filesystem
"""
try:
self.file.path
return True
except NotImplementedError:
return False
@contextmanager
def open_file(self):
# Open file if it is closed