Skip to content
Snippets Groups Projects
Verified Commit 6c16b8ba authored by Anton Akhmerov's avatar Anton Akhmerov
Browse files

fix empty message

parent f3b122de
No related branches found
No related tags found
No related merge requests found
......@@ -102,12 +102,13 @@ class JupyterpostMagics(Magics):
def post(self, line, cell=None):
"""Post a message to Mattermost using the JupyterHub service."""
args = magic_arguments.parse_argstring(self.post, line)
message = [" ".join(args.message)]
message = " ".join(args.message)
if cell is None:
if not message[0]:
if not message:
raise ValueError("No message given")
post(message[0], args.channel, service_url=args.url, token=args.token)
post(message, args.channel, service_url=args.url, token=args.token)
return
message = [message] if message else [""] # Zero-width space for linebreaks
if args.raw:
message = "\n".join((message[0], cell))
post(message, args.channel, service_url=args.url, token=args.token)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment