diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-11-23 11:48:09 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-11-23 11:48:09 +0200 |
commit | 6eec9f17e97e408b4c82f001ffc8a7ea399a0ed6 (patch) | |
tree | d9effdb8202f89bf820bf16ba39e4bbe268c5edf /jt | |
parent | c1ac7db2f3ab0d64e82c569a4282f05041bd0d53 (diff) | |
download | jt-6eec9f17e97e408b4c82f001ffc8a7ea399a0ed6.tar.gz |
Check that topic pages exist
Diffstat (limited to 'jt')
-rwxr-xr-x | jt | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -118,6 +118,8 @@ class NewCommand(Command): self._app.settings.require('source') topic = self._app.settings['topic'] + if topic and not self._topic_page_exists(topic): + raise cliapp.AppException('Topic %s does not exist yet' % topic) values = { 'title': args[0], @@ -130,6 +132,10 @@ class NewCommand(Command): draft_id = drafts_dir.create_draft(template % values) self._app.edit_file(drafts_dir.get_draft_pathname(draft_id)) + def _topic_page_exists(self, topic): + pathname = os.path.join(self._app.settings['source'], topic + '.mdwn') + return os.path.exists(pathname) + def _get_topic_link(self, topic): if topic: return 'Part of [[%s]]' % topic |