comparison piecrust/sources/posts.py @ 987:d57fff79acc1

prepare: Fix a crash when preparing a new post.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 31 Oct 2017 09:33:36 -0700
parents 84fc72a17f7a
children 8adc27285d93
comparison
equal deleted inserted replaced
986:ef224cce343c 987:d57fff79acc1
152 RouteParameter('month', RouteParameter.TYPE_INT2), 152 RouteParameter('month', RouteParameter.TYPE_INT2),
153 RouteParameter('year', RouteParameter.TYPE_INT4)] 153 RouteParameter('year', RouteParameter.TYPE_INT4)]
154 154
155 def setupPrepareParser(self, parser, app): 155 def setupPrepareParser(self, parser, app):
156 parser.add_argument( 156 parser.add_argument(
157 '-d', '--date', help="The date of the post, " 157 '-d', '--date',
158 "in `year/month/day` format (defaults to today).") 158 default='today',
159 help=("The date of the post, in `year/month/day` format "
160 "(defaults to today)."))
159 parser.add_argument('slug', help="The URL slug for the new post.") 161 parser.add_argument('slug', help="The URL slug for the new post.")
160 162
161 def createContent(self, args): 163 def createContent(self, args):
162 dt = datetime.date.today() 164 dt = datetime.date.today()
163 date = args.get('date') 165 date = args.get('date')