Mercurial > piecrust2
comparison piecrust/sources/default.py @ 892:c445a3d5d950
internal: Make `createContent` use a dictionary-like object.
| author | Ludovic Chabant <ludovic@chabant.com> |
|---|---|
| date | Sun, 02 Jul 2017 22:20:32 -0700 |
| parents | d9059257743c |
| children | 86b684cc0551 |
comparison
equal
deleted
inserted
replaced
| 891:f13d618cfec6 | 892:c445a3d5d950 |
|---|---|
| 90 | 90 |
| 91 def setupPrepareParser(self, parser, app): | 91 def setupPrepareParser(self, parser, app): |
| 92 parser.add_argument('uri', help='The URI for the new page.') | 92 parser.add_argument('uri', help='The URI for the new page.') |
| 93 | 93 |
| 94 def createContent(self, args): | 94 def createContent(self, args): |
| 95 if not hasattr(args, 'uri'): | 95 uri = args.get('uri') |
| 96 uri = None | |
| 97 else: | |
| 98 uri = args.uri | |
| 99 if not uri: | 96 if not uri: |
| 100 uri = '_index' | 97 uri = '_index' |
| 101 path = os.path.join(self.fs_endpoint_path, uri) | 98 path = os.path.join(self.fs_endpoint_path, uri) |
| 102 _, ext = os.path.splitext(path) | 99 _, ext = os.path.splitext(path) |
| 103 if ext == '': | 100 if ext == '': |
