def get_updated_messages(note, accessURL, manifestStr, pin): '''Generates and returns the final html and plain-text e-mail body texts to be sent to the SMART Direct recipient ''' html = "" text = "" # Parse the apps list and build a new list containing only # the manifest details of the apps needed for this message apps = json.loads(get_app_manifests()) manifest = json.loads(manifestStr) myapps = [x['id'] for x in manifest['apps']] apps_out = [a for a in apps if a['id'] in myapps] # Build the final messages from the templates template_html = web.template.frender(APP_PATH + '/templates/message-apps.html') template_text = web.template.frender(APP_PATH + '/templates/message-apps.txt') html = template_html(note, str(pin), accessURL, apps_out) text = template_text(remove_html_tags(note), str(pin), accessURL, apps_out) # Return the final messages as strings return [str(text), str(html)]
def get_updated_messages(note, accessURL, manifestStr, pin): '''Generates and returns the final html and plain-text e-mail body texts to be sent to the SMART Direct recipient ''' html = "" text = "" # Parse the apps list and build a new list containing only # the manifest details of the apps needed for this message apps = json.loads(get_app_manifests()) manifest = json.loads(manifestStr) myapps = [x['id'] for x in manifest['apps']] apps_out = [a for a in apps if a['id'] in myapps] # Build the final messages from the templates template_html = web.template.frender(APP_PATH + '/templates/message-apps.html') template_text = web.template.frender(APP_PATH + '/templates/message-apps.txt') html = template_html(note, str(pin), accessURL, apps_out) text = template_text(remove_html_tags(note), str(pin), accessURL, apps_out) # Return the final messages as strings return [str(text),str(html)]
def GET(self): # First, try setting up a dummy SMART client to test the credentials # for securty reasons (will raise excepton if the credentails are bad) get_smart_client() return get_app_manifests()