def _add_link(l): if isinstance(feed, OPDSFeed): feed.add_link_to_feed(feed.feed, **l) else: # This is an ElementTree object. link = OPDSFeed.link(**l) feed.append(link)
def add_configuration_links(cls, feed): for rel, value in ( ("terms-of-service", Configuration.terms_of_service_url()), ("privacy-policy", Configuration.privacy_policy_url()), ("copyright", Configuration.acknowledgements_url()), ("about", Configuration.about_url()), ("license", Configuration.license_url()), ): if value: d = dict(href=value, type="text/html", rel=rel) if isinstance(feed, OPDSFeed): feed.add_link_to_feed(feed.feed, **d) else: # This is an ElementTree object. link = OPDSFeed.link(**d) feed.append(link)