Ticket #14132: fix14132.patch

File fix14132.patch, 2.0 KB (added by Matthias Kestenholz, 14 years ago)
  • django/utils/feedgenerator.py

    diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py
    index 4175317..195a112 100644
    a b import datetime  
    2727import urlparse
    2828from django.utils.xmlutils import SimplerXMLGenerator
    2929from django.utils.encoding import force_unicode, iri_to_uri
     30from django.utils import datetime_safe
    3031
    3132def rfc2822_date(date):
    3233    # We do this ourselves to be timezone aware, email.Utils is not tz aware.
    3334    if date.tzinfo:
    34         time_str = date.strftime('%a, %d %b %Y %H:%M:%S ')
     35        time_str = datetime_safe.new_date(date).strftime('%a, %d %b %Y %H:%M:%S ')
    3536        offset = date.tzinfo.utcoffset(date)
    3637        timezone = (offset.days * 24 * 60) + (offset.seconds / 60)
    3738        hour, minute = divmod(timezone, 60)
    3839        return time_str + "%+03d%02d" % (hour, minute)
    3940    else:
    40         return date.strftime('%a, %d %b %Y %H:%M:%S -0000')
     41        return datetime_safe.new_date(date).strftime('%a, %d %b %Y %H:%M:%S -0000')
    4142
    4243def rfc3339_date(date):
    4344    if date.tzinfo:
    44         time_str = date.strftime('%Y-%m-%dT%H:%M:%S')
     45        time_str = datetime_safe.new_date(date).strftime('%Y-%m-%dT%H:%M:%S')
    4546        offset = date.tzinfo.utcoffset(date)
    4647        timezone = (offset.days * 24 * 60) + (offset.seconds / 60)
    4748        hour, minute = divmod(timezone, 60)
    4849        return time_str + "%+03d:%02d" % (hour, minute)
    4950    else:
    50         return date.strftime('%Y-%m-%dT%H:%M:%SZ')
     51        return datetime_safe.new_date(date).strftime('%Y-%m-%dT%H:%M:%SZ')
    5152
    5253def get_tag_uri(url, date):
    5354    """
  • tests/regressiontests/syndication/fixtures/feeddata.json

    diff --git a/tests/regressiontests/syndication/fixtures/feeddata.json b/tests/regressiontests/syndication/fixtures/feeddata.json
    index 4a5c022..167115c 100644
    a b  
    44    "pk": 1,
    55    "fields": {
    66      "title": "My first entry",
    7       "date": "2008-01-01 12:30:00"
     7      "date": "1850-01-01 12:30:00"
    88    }
    99  },
    1010  {
Back to Top