def show_message(msg):
"""Display a message if the msg value is greater than 2 characters
in the path.
"""
valid_length = len(msg) >= MIN_MSG_LENGTH
valid_name = re.match('^[a-z\-]+$', msg.lower()) is not None
if valid_length and valid_name:
return template(TEMPLATE_STRING, h1=msg)
else:
error_msg = "Sorry, only alpha characters and hyphens allowed."
raise Exception(error_msg)
评论列表
文章目录