Make review-requests API properly handle ambiguous times.

Review Request #8607 — Created Jan. 9, 2017 and submitted

Information

Review Board
release-2.5.x
c94f702...

Reviewers

Because we live in a silly world where some people arbitrarily move their
clocks back and forth by an hour, timestamps, even those containing timezone
information, may not be unique. In particular, this could cause problems when
fetching the review-requests resource using the time-limiting fields with a
timestamp that exists during the hour after the transition from
daylight-savings time to standard time.

This change fixes things up to catch the error and return a reasonable error
via the API, rather than a 500 and a traceback. This also fixes it up so
invalid timestamp strings return an error rather than getting silently ignored.

Ran unit tests.

Description From Last Updated

local variable 'e' is assigned to but never used

reviewbotreviewbot

Any reason to do this over a loop?

brenniebrennie

I was under the impression we went through django.utils.timezone (which I believe is a re-export of pytz?) throughout the rest …

brenniebrennie

""" on next line.

brenniebrennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
    
    
  2. Show all issues
     local variable 'e' is assigned to but never used
    
  3. 
      
david
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
    
    
  2. 
      
brennie
  1. 
      
  2. reviewboard/webapi/resources/review_request.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Any reason to do this over a loop?

  3. Show all issues

    I was under the impression we went through django.utils.timezone (which I believe is a re-export of pytz?) throughout the rest of the codebase.

    1. django.utils.timezone are django-specific things relating to activating a timezone and making datetimes aware.

  4. Show all issues

    """ on next line.

  5. 
      
david
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
    
    
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.5.x (b566240)