def format(self): """ Same as above, however takes a single `templateORM` and formats the datetime markdown. :param tmpl: The `templateORM` object of the tmpl to format :return: """ self.formatedTemplate = mdu.mark(self.template) self.formatedDate = datetime.strftime(self.created, "%a %b %d, %Y @ %H:%I%p")
def compileTmpl(self, tmpl, tmplData): """ Takes in the given template, and filles it out with mustache from `tmplData` Then compiles it into HTML with markdown. :param tmpl: The mustache and markdown template to fill out and render :param tmplData: The dict of values to render the template with, for mustache :return: `part1, part2` are `MIMEText` objects with encodings of plain and HTML for use in `MIMEMultipart` messages. """ compiledTmpl = pystache.render(tmpl, tmplData) tmplMarked = mdu.mark(compiledTmpl) part1 = MIMEText(compiledTmpl, 'plain') part2 = MIMEText(tmplMarked, 'html') return part1, part2