Changeset 24:3501b870f565 in stamper


Ignore:
Timestamp:
Jul 26, 2014, 6:18:22 PM (10 years ago)
Author:
Borja Lopez <borja@…>
Branch:
default
Phase:
public
Message:

Fixed the date-range validator, so date ranges YYYY-MM-DD--YYYY-MM-DD
are identified as valid filters.
Replaced -YYYY-MM-DD with _YYYY-MM-DD to prevent conflicts with argparse

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stamper/stamper.py

    r23 r24  
    6161        - %Y-%m-%d--%Y-%m-%d: Times recorded between two dates
    6262
    63         - -%Y-%m-%d: Times recorded before a given date
     63        - _%Y-%m-%d: Times recorded before a given date
    6464
    6565        - +%Y-%m-%d: Times recorded after a given date
     
    6868        """
    6969        # First try the date filters, one by one
    70         matches = ['%Y-%m-%d', '-%Y-%m-%d', '+%Y-%m-%d']
     70        matches = ['%Y-%m-%d', '_%Y-%m-%d', '+%Y-%m-%d']
    7171        for match in matches:
    7272            try:
    7373                if '--' in stamp_filter:
    7474                    filter_from, filter_to = stamp_filter.split('--')
    75                     filter_from = datetime.strptime(stamp_filter, match)
    76                     filter_to = datetime.strptime(stamp_filter, match)
     75                    filter_from = datetime.strptime(filter_from, match)
     76                    filter_to = datetime.strptime(filter_to, match)
    7777                else:
    7878                    valid_filter = datetime.strptime(stamp_filter, match)
Note: See TracChangeset for help on using the changeset viewer.