~sambuddhabasu1/mailman/fix_mailman_run_error

« back to all changes in this revision

Viewing changes to src/mailman/runners/archive.py

  • Committer: Barry Warsaw
  • Date: 2012-03-24 01:45:12 UTC
  • Revision ID: barry@list.org-20120324014512-qa086tsn10ttgcei
Last minute emergency bandaid for bug LP: #963612

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        clobber = False
51
51
        original_date = msg.get('date')
52
52
        received_time = formatdate(msgdata['received_time'])
53
 
        if not original_date:
54
 
            clobber = True
55
 
        elif int(config.archiver.pipermail.clobber_date_policy) == 1:
56
 
            clobber = True
57
 
        elif int(config.archiver.pipermail.clobber_date_policy) == 2:
58
 
            # What's the timestamp on the original message?
59
 
            timetup = parsedate_tz(original_date)
60
 
            now = datetime.now()
61
 
            try:
62
 
                if not timetup:
63
 
                    clobber = True
64
 
                else:
65
 
                    utc_timestamp = datetime.fromtimestamp(mktime_tz(timetup))
66
 
                    date_skew = as_timedelta(
67
 
                        config.archiver.pipermail.allowable_sane_date_skew)
68
 
                    clobber = (abs(now - utc_timestamp) > date_skew)
69
 
            except (ValueError, OverflowError):
70
 
                # The likely cause of this is that the year in the Date: field
71
 
                # is horribly incorrect, e.g. (from SF bug # 571634):
72
 
                # Date: Tue, 18 Jun 0102 05:12:09 +0500
73
 
                # Obviously clobber such dates.
74
 
                clobber = True
75
 
        if clobber:
76
 
            del msg['date']
77
 
            del msg['x-original-date']
78
 
            msg['Date'] = received_time
79
 
            if original_date:
80
 
                msg['X-Original-Date'] = original_date
 
53
        # FIXME 2012-03-23 BAW: LP: #963612
 
54
        ## if not original_date:
 
55
        ##     clobber = True
 
56
        ## elif int(config.archiver.pipermail.clobber_date_policy) == 1:
 
57
        ##     clobber = True
 
58
        ## elif int(config.archiver.pipermail.clobber_date_policy) == 2:
 
59
        ##     # What's the timestamp on the original message?
 
60
        ##     timetup = parsedate_tz(original_date)
 
61
        ##     now = datetime.now()
 
62
        ##     try:
 
63
        ##         if not timetup:
 
64
        ##             clobber = True
 
65
        ##         else:
 
66
        ##             utc_timestamp = datetime.fromtimestamp(mktime_tz(timetup))
 
67
        ##             date_skew = as_timedelta(
 
68
        ##                 config.archiver.pipermail.allowable_sane_date_skew)
 
69
        ##             clobber = (abs(now - utc_timestamp) > date_skew)
 
70
        ##     except (ValueError, OverflowError):
 
71
        ##         # The likely cause of this is that the year in the Date: field
 
72
        ##         # is horribly incorrect, e.g. (from SF bug # 571634):
 
73
        ##         # Date: Tue, 18 Jun 0102 05:12:09 +0500
 
74
        ##         # Obviously clobber such dates.
 
75
        ##         clobber = True
 
76
        ## if clobber:
 
77
        ##     del msg['date']
 
78
        ##     del msg['x-original-date']
 
79
        ##     msg['Date'] = received_time
 
80
        ##     if original_date:
 
81
        ##         msg['X-Original-Date'] = original_date
81
82
        # Always put an indication of when we received the message.
82
83
        msg['X-List-Received-Date'] = received_time
83
84
        # While a list archiving lock is acquired, archive the message.