fix
This commit is contained in:
parent
2c9ea743a3
commit
d517e48e8c
@ -35,6 +35,9 @@ class PostNotFound(Exception):
|
||||
class NoPostsLeft(Exception):
|
||||
pass
|
||||
|
||||
class PostTypeMismatch(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class PostType(Enum):
|
||||
ARTICLE = 'article'
|
||||
@ -290,9 +293,9 @@ async def do_send(type: Optional[PostType] = None,
|
||||
if db.is_already_published(filename):
|
||||
continue
|
||||
post = Post(filename)
|
||||
if post.type == type:
|
||||
break
|
||||
post = None
|
||||
if post.type != type:
|
||||
raise PostTypeMismatch()
|
||||
break
|
||||
|
||||
if not post:
|
||||
raise NoPostsLeft()
|
||||
@ -404,7 +407,7 @@ if __name__ == '__main__':
|
||||
asyncio.run(do_send(type=PostType(args.type) if args.type else None,
|
||||
mark_as_published=args.prod or args.mark,
|
||||
post_name=args.name))
|
||||
except NoPostsLeft:
|
||||
except (NoPostsLeft, PostTypeMismatch):
|
||||
logger.warning('no unpublished posts matching the current mode criteria')
|
||||
break
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user