Ticket #7944: strptime_delimiters.patch

File strptime_delimiters.patch, 1.8 KB (added by justinlilly@…, 16 years ago)

added strptime delimiters

  • AUTHORS

    diff --git a/AUTHORS b/AUTHORS
    index e22ee45..8190571 100644
    a b answer newbie questions, and generally made Django that much better:  
    243243    Jannis Leidel <jl@websushi.org>
    244244    Christopher Lenz <http://www.cmlenz.net/>
    245245    lerouxb@gmail.com
     246    Justin Lilly <justinlilly@gmail.com>
    246247    Waylan Limberg <waylan@gmail.com>
    247248    limodou
    248249    Philip Lindborg <philip.lindborg@gmail.com>
  • django/views/generic/date_based.py

    diff --git a/django/views/generic/date_based.py b/django/views/generic/date_based.py
    index a745559..f2334ec 100644
    a b def archive_month(request, year, month, queryset, date_field,  
    116116    """
    117117    if extra_context is None: extra_context = {}
    118118    try:
    119         date = datetime.date(*time.strptime(year+month, '%Y'+month_format)[:3])
     119        date = datetime.date(*time.strptime("%s %s" % (year, month), '%s %s' % ('%Y', month_format))[:3])
    120120    except ValueError:
    121121        raise Http404
    122122
    def archive_day(request, year, month, day, queryset, date_field,  
    231231    """
    232232    if extra_context is None: extra_context = {}
    233233    try:
    234         date = datetime.date(*time.strptime(year+month+day, '%Y'+month_format+day_format)[:3])
     234        date = datetime.date(*time.strptime("%s %s %s" % (year, month, day), '%s %s %s' % ('%Y', month_format, day_format))[:3])
    235235    except ValueError:
    236236        raise Http404
    237237
    def object_detail(request, year, month, day, queryset, date_field,  
    301301    """
    302302    if extra_context is None: extra_context = {}
    303303    try:
    304         date = datetime.date(*time.strptime(year+month+day, '%Y'+month_format+day_format)[:3])
     304        date = datetime.date(*time.strptime('%s %s %s' % (year, month, day), '%s %s %s' % ('%Y', month_format, day_format))[:3])
    305305    except ValueError:
    306306        raise Http404
    307307
Back to Top