##// END OF EJS Templates
helpers: flash messages can now carry additional information in json format
ergo -
r952:039d714b default
parent child Browse files
Show More
@@ -682,14 +682,23 b' class Flash(_Flash):'
682 payloads = []
682 payloads = []
683 messages = flash.pop_messages()
683 messages = flash.pop_messages()
684 if messages:
684 if messages:
685 for message in messages:
685 for message in messages:
686 payloads.append({
686 subdata = {}
687 'message': {
687 if hasattr(message.message, 'rsplit'):
688 'message': u'{}'.format(message.message),
688 flash_data = message.message.rsplit('|DELIM|', 1)
689 'level': message.category,
689 org_message = flash_data[0]
690 'force': 'true'
690 if len(flash_data) > 1:
691 }
691 subdata = json.loads(flash_data[1])
692 })
692 else:
693 org_message = message.message
694 payloads.append({
695 'message': {
696 'message': u'{}'.format(org_message),
697 'level': message.category,
698 'force': True,
699 'subdata': subdata
700 }
701 })
693 return json.dumps(payloads)
702 return json.dumps(payloads)
694
703
695 flash = Flash()
704 flash = Flash()
General Comments 0
You need to be logged in to leave comments. Login now