forked from github/pelican
Merge pull request #2455 from oulenz/static_content
Disinherit Page from Static so default draft status does not affect save_as
This commit is contained in:
commit
a0c0816191
2 changed files with 20 additions and 1 deletions
|
|
@ -527,7 +527,11 @@ class Article(Content):
|
|||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Static(Page):
|
||||
class Static(Content):
|
||||
mandatory_properties = ('title',)
|
||||
default_status = 'published'
|
||||
default_template = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Static, self).__init__(*args, **kwargs)
|
||||
self._output_location_referenced = False
|
||||
|
|
|
|||
|
|
@ -917,3 +917,18 @@ class TestStatic(LoggedTestCase):
|
|||
self.settings['INDEX_SAVE_AS'])) +
|
||||
'">link</a>')
|
||||
self.assertEqual(content, expected_html)
|
||||
|
||||
def test_not_save_as_draft(self):
|
||||
"""Static.save_as is not affected by draft status."""
|
||||
|
||||
static = Static(
|
||||
content=None,
|
||||
metadata=dict(status='draft',),
|
||||
settings=self.settings,
|
||||
source_path=os.path.join('dir', 'foo.jpg'),
|
||||
context=self.settings.copy())
|
||||
|
||||
expected_save_as = os.path.join('dir', 'foo.jpg')
|
||||
self.assertEqual(static.status, 'draft')
|
||||
self.assertEqual(static.save_as, expected_save_as)
|
||||
self.assertEqual(static.url, path_to_url(expected_save_as))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue