Mercurial > piecrust2
diff piecrust/sources/default.py @ 576:0c74a6c4533d
sources: Add code to support "interactive" metadata acquisition.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 19 Dec 2015 18:07:21 -0800 |
parents | bab91fcef741 |
children | ff404adfcf45 |
line wrap: on
line diff
--- a/piecrust/sources/default.py Sat Dec 19 18:06:16 2015 -0800 +++ b/piecrust/sources/default.py Sat Dec 19 18:07:21 2015 -0800 @@ -4,7 +4,9 @@ from piecrust.sources.base import ( PageFactory, PageSource, InvalidFileSystemEndpointError, MODE_CREATING) -from piecrust.sources.interfaces import IListableSource, IPreparingSource +from piecrust.sources.interfaces import ( + IListableSource, IPreparingSource, IInteractiveSource, + InteractiveField) from piecrust.sources.mixins import SimplePaginationSourceMixin @@ -21,7 +23,8 @@ f not in ['Thumbs.db']) # Windows bullshit -class DefaultPageSource(PageSource, IListableSource, IPreparingSource, +class DefaultPageSource(PageSource, + IListableSource, IPreparingSource, IInteractiveSource, SimplePaginationSourceMixin): SOURCE_NAME = 'default' @@ -134,6 +137,11 @@ def buildMetadata(self, args): return {'slug': args.uri} + def getInteractiveFields(self): + return [ + InteractiveField('slug', InteractiveField.TYPE_STRING, + 'new-page')] + def _makeSlug(self, rel_path): slug, ext = os.path.splitext(rel_path) slug = slug.replace('\\', '/')