Mercurial > piecrust2
comparison piecrust/sources/default.py @ 944:23052bf8a62b
sources: Change argument name in default source's `createContent`.
This is so it's compatible with the interactive fields' argument names.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 05 Oct 2017 00:23:56 -0700 |
parents | 86b684cc0551 |
children | 8adc27285d93 |
comparison
equal
deleted
inserted
replaced
943:b61dd60aff36 | 944:23052bf8a62b |
---|---|
91 def findContentFromPath(self, path): | 91 def findContentFromPath(self, path): |
92 metadata = self._doCreateItemMetadata(path) | 92 metadata = self._doCreateItemMetadata(path) |
93 return ContentItem(path, metadata) | 93 return ContentItem(path, metadata) |
94 | 94 |
95 def setupPrepareParser(self, parser, app): | 95 def setupPrepareParser(self, parser, app): |
96 parser.add_argument('uri', help='The URI for the new page.') | 96 parser.add_argument('slug', help='The slug for the new page.') |
97 | 97 |
98 def createContent(self, args): | 98 def createContent(self, args): |
99 uri = args.get('uri') | 99 slug = args.get('slug') |
100 if not uri: | 100 if not slug: |
101 uri = '_index' | 101 slug = '_index' |
102 path = os.path.join(self.fs_endpoint_path, uri) | 102 path = os.path.join(self.fs_endpoint_path, slug) |
103 _, ext = os.path.splitext(path) | 103 _, ext = os.path.splitext(path) |
104 if ext == '': | 104 if ext == '': |
105 path = '%s.%s' % (path, self.default_auto_format) | 105 path = '%s.%s' % (path, self.default_auto_format) |
106 | 106 |
107 metadata = self._doCreateItemMetadata(path) | 107 metadata = self._doCreateItemMetadata(path) |