How to use the feedgenerator.django.utils.datetime_safe.new_datetime function in feedgenerator

To help you get started, we’ve selected a few feedgenerator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github getpelican / feedgenerator / feedgenerator / django / utils / feedgenerator.py View on Github external
def get_tag_uri(url, date):
    """
    Creates a TagURI.

    See http://web.archive.org/web/20110514113830/http://diveintomark.org/archives/2004/05/28/howto-atom-id
    """
    bits = urlparse(url)
    d = ''
    if date is not None:
        d = ',%s' % datetime_safe.new_datetime(date).strftime('%Y-%m-%d')
    fragment = ''
    if bits.fragment != '':
        fragment = '/%s' % (bits.fragment)
    return 'tag:%s%s:%s%s' % (bits.hostname, d, bits.path, fragment)