Mercurial > piecrust2
comparison piecrust/admin/views/edit.py @ 1195:ae9387338db1 draft default tip
admin: add option to publish immediately
| author | Ludovic Chabant <ludovic@chabant.com> |
|---|---|
| date | Fri, 30 Dec 2022 16:48:04 -0800 |
| parents | 0d699f04968c |
| children |
comparison
equal
deleted
inserted
replaced
| 1194:09d5c233e840 | 1195:ae9387338db1 |
|---|---|
| 46 commit_paths = [page_spec] | 46 commit_paths = [page_spec] |
| 47 assets_dir = os.path.splitext(page_spec)[0] + '-assets' | 47 assets_dir = os.path.splitext(page_spec)[0] + '-assets' |
| 48 if os.path.isdir(assets_dir): | 48 if os.path.isdir(assets_dir): |
| 49 commit_paths += list(os.listdir(assets_dir)) | 49 commit_paths += list(os.listdir(assets_dir)) |
| 50 site.scm.commit(commit_paths, message) | 50 site.scm.commit(commit_paths, message) |
| 51 | |
| 52 if 'do_publish' in request.form: | |
| 53 pub_cfg = site_app.config.get('publish', {}) | |
| 54 if pub_cfg: | |
| 55 first_target = pub_cfg.keys()[0] | |
| 56 site_app.publish(first_target) | |
| 57 return redirect(url_for('.publish')) | |
| 51 | 58 |
| 52 if 'do_save' in request.form or 'do_save_and_commit' in request.form: | 59 if 'do_save' in request.form or 'do_save_and_commit' in request.form: |
| 53 return _edit_page_form(page, url) | 60 return _edit_page_form(page, url) |
| 54 | 61 |
| 55 abort(400) | 62 abort(400) |
