def get_headers(page): """ Return a dictionary of the special email headers for this `page`. Supports email threading. """ # Let's keep the reply-to ID the same even if the capitalization of the page # is changed. p = Page(name=page.name.lower(), region=page.region, content="") reply_to_id = "</page%s@%s>" % (p.get_absolute_url(), DNS_NAME) return {"In-Reply-To": reply_to_id, "References": reply_to_id}
def get_headers(page): """ Return a dictionary of the special email headers for this `page`. Supports email threading. """ # Let's keep the reply-to ID the same even if the capitalization of the page # is changed. p = Page(name=page.name.lower(), region=page.region, content="") reply_to_id = "</page%s@%s>" % (p.get_absolute_url(), DNS_NAME) return { 'In-Reply-To': reply_to_id, 'References': reply_to_id, }
def _parse_sitemap(self, list_node, menu_node): """Recursively parse sitemap parsed from a YAML file. Will populate the ElementTree node in `menu_node` and will do so in a recursive manner. @list_node The portion of the list we are parsing @menu_node The ElementTree node where we'll append nodes """ for title, children in list_node: n = et.SubElement(menu_node, "node") p = Page(title=title, name=slugify(title), user=self.default_user) p.save() xml_attr = dict(title=p.title, name=p.name, href=p.get_absolute_url(), contenttype=str(self.content_type), objectid=str(p.id)) for key, value in xml_attr.items(): n.set(key, value) if children is not None: self._parse_sitemap(children, n)