Mercurial > piecrust2
changeset 947:a85b2827ba1a
prepare: Fix old API calls.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 05 Oct 2017 00:25:10 -0700 |
parents | 8ca228956cc6 |
children | 6c445771a8dc |
files | piecrust/commands/builtin/scaffolding.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/commands/builtin/scaffolding.py Thu Oct 05 00:24:44 2017 -0700 +++ b/piecrust/commands/builtin/scaffolding.py Thu Oct 05 00:25:10 2017 -0700 @@ -83,6 +83,8 @@ source = ctx.args.source content_item = source.createContent(vars(ctx.args)) + if content_item is None: + raise Exception("Can't create item.") config_tokens = { '%title%': "Untitled Content", @@ -97,7 +99,7 @@ logger.info("Creating content: %s" % content_item.spec) mode = 'w' if ctx.args.force else 'x' - with content_item.open(mode) as f: + with source.openItem(content_item, mode) as f: f.write(tpl_text) # If this was a file-system content item, see if we need to auto-open