def post(self, title, text=''): arg = ' '.join(title) try: with open(arg, 'r'): post = Post.from_file(arg) except Exception: try: post = Post.from_slugish(arg) assert post is not None except Exception: post = Post.from_title(arg, text) return post