Mercurial > piecrust2
comparison piecrust/commands/builtin/themes.py @ 475:c5df200354e8
themes: Fix crash when invoking command with no sub-command.
| author | Ludovic Chabant <ludovic@chabant.com> |
|---|---|
| date | Sun, 19 Jul 2015 17:00:57 -0700 |
| parents | d70a4adb61dd |
| children | d5885c6d64bd |
comparison
equal
deleted
inserted
replaced
| 474:750160edefb7 | 475:c5df200354e8 |
|---|---|
| 39 'override', | 39 'override', |
| 40 help="Copies a theme to the website for customization.") | 40 help="Copies a theme to the website for customization.") |
| 41 p.set_defaults(sub_func=self._overrideTheme) | 41 p.set_defaults(sub_func=self._overrideTheme) |
| 42 | 42 |
| 43 def checkedRun(self, ctx): | 43 def checkedRun(self, ctx): |
| 44 if not hasattr(ctx.args, 'sub_func'): | |
| 45 ctx.parser.parse_args(['themes', '--help']) | |
| 46 return | |
| 44 ctx.args.sub_func(ctx) | 47 ctx.args.sub_func(ctx) |
| 45 | 48 |
| 46 def _createTheme(self, ctx): | 49 def _createTheme(self, ctx): |
| 47 theme_dir = os.path.join(ctx.app.root_dir, THEME_DIR) | 50 theme_dir = os.path.join(ctx.app.root_dir, THEME_DIR) |
| 48 if os.path.exists(theme_dir): | 51 if os.path.exists(theme_dir): |
