diff piecrust/commands/builtin/scaffolding.py @ 947:a85b2827ba1a

prepare: Fix old API calls.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 05 Oct 2017 00:25:10 -0700
parents c445a3d5d950
children 74c0c7483986
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