Convert URL patterns to lists.

Review Request #8723 - Created Feb. 7, 2017 and submitted

David Trowbridge
Review Board
release-3.0.x
c2417de...
reviewboard

Django has deprecated the use of the old patterns() method, since they now
recommend that all URLs pass in the view directly rather than do string magic
to get the module path. This change moves us over to using plain lists of
url() entries, rather than a bunch of calls to patterns().

While I was doing this, I cleaned things up a bit with the regexes (such as
converting [0-9] to \d and [a-zA-Z0-9_] to \w), and changed it so we
only use raw strings where necessary.

Ran unit tests on Django 1.6 and 1.8.

  • 0
  • 0
  • 12
  • 0
  • 12
Description From Last Updated
Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/admin.py
        reviewboard/hostingsvcs/urls.py
        reviewboard/hostingsvcs/beanstalk.py
        reviewboard/accounts/urls.py
        reviewboard/reviews/urls.py
        reviewboard/hostingsvcs/bitbucket.py
        reviewboard/admin/urls.py
        reviewboard/urls.py
        reviewboard/hostingsvcs/service.py
        reviewboard/search/urls.py
        reviewboard/hostingsvcs/github.py
        reviewboard/hostingsvcs/googlecode.py
        reviewboard/hostingsvcs/tests/test_registration.py
        reviewboard/datagrids/urls.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/scmtools/admin.py
        reviewboard/hostingsvcs/urls.py
        reviewboard/hostingsvcs/beanstalk.py
        reviewboard/accounts/urls.py
        reviewboard/reviews/urls.py
        reviewboard/hostingsvcs/bitbucket.py
        reviewboard/admin/urls.py
        reviewboard/urls.py
        reviewboard/hostingsvcs/service.py
        reviewboard/search/urls.py
        reviewboard/hostingsvcs/github.py
        reviewboard/hostingsvcs/googlecode.py
        reviewboard/hostingsvcs/tests/test_registration.py
        reviewboard/datagrids/urls.py
    
    
  2. 
      
Christian Hammond
  1. 
      
  2. reviewboard/urls.py (Diff revision 1)
     
     
     

    Instead of importing each view directly, I'm wondering about just importing views as appname_views (reviews_views, admin_views, etc.). Then we can reference the particular views as attributes instead of managing the import lists. I've seen this pattern with some other Django apps.

    What are your thoughts?

  3. 
      
David Trowbridge
Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/admin.py
        reviewboard/hostingsvcs/urls.py
        reviewboard/hostingsvcs/beanstalk.py
        reviewboard/accounts/urls.py
        reviewboard/reviews/urls.py
        reviewboard/hostingsvcs/bitbucket.py
        reviewboard/admin/urls.py
        reviewboard/urls.py
        reviewboard/hostingsvcs/service.py
        reviewboard/search/urls.py
        reviewboard/hostingsvcs/github.py
        reviewboard/hostingsvcs/googlecode.py
        reviewboard/hostingsvcs/tests/test_registration.py
        reviewboard/datagrids/urls.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/scmtools/admin.py
        reviewboard/hostingsvcs/urls.py
        reviewboard/hostingsvcs/beanstalk.py
        reviewboard/accounts/urls.py
        reviewboard/reviews/urls.py
        reviewboard/hostingsvcs/bitbucket.py
        reviewboard/admin/urls.py
        reviewboard/urls.py
        reviewboard/hostingsvcs/service.py
        reviewboard/search/urls.py
        reviewboard/hostingsvcs/github.py
        reviewboard/hostingsvcs/googlecode.py
        reviewboard/hostingsvcs/tests/test_registration.py
        reviewboard/datagrids/urls.py
    
    
  2. 
      
Barret Rennie
  1. Ship It!
  2. 
      
Christian Hammond
  1. 
      
  2. reviewboard/datagrids/urls.py (Diff revision 2)
     
     
     
     
     

    One blank line, for consistency with the above.

  3. reviewboard/hostingsvcs/beanstalk.py (Diff revision 2)
     
     
     
     

    I don't love having to mix these throughout the file, but I also never quite loved some of these being top-level to begin with. Can we maybe introduce a BeanstalkHookViews class to contain this function and utility functions? Will also help with organization down the road when we add more hooks.

    Same would apply to the other services.

  4. reviewboard/hostingsvcs/beanstalk.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     

    Mind removing these blank lines before except while here?

  5. reviewboard/reviews/urls.py (Diff revision 2)
     
     

    I'd prefer to keep the r prefix for all regexes. It makes it a lot easier to copy/paste/modify regexes without unintentionally breaking things.

  6. reviewboard/scmtools/admin.py (Diff revision 2)
     
     
     

    Swap these.

  7. 
      
David Trowbridge
Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/admin.py
        reviewboard/hostingsvcs/urls.py
        reviewboard/hostingsvcs/beanstalk.py
        reviewboard/accounts/urls.py
        reviewboard/reviews/urls.py
        reviewboard/hostingsvcs/bitbucket.py
        reviewboard/admin/urls.py
        reviewboard/urls.py
        reviewboard/hostingsvcs/service.py
        reviewboard/search/urls.py
        reviewboard/hostingsvcs/github.py
        reviewboard/hostingsvcs/googlecode.py
        reviewboard/hostingsvcs/tests/test_registration.py
        reviewboard/datagrids/urls.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/scmtools/admin.py
        reviewboard/hostingsvcs/urls.py
        reviewboard/hostingsvcs/beanstalk.py
        reviewboard/accounts/urls.py
        reviewboard/reviews/urls.py
        reviewboard/hostingsvcs/bitbucket.py
        reviewboard/admin/urls.py
        reviewboard/urls.py
        reviewboard/hostingsvcs/service.py
        reviewboard/search/urls.py
        reviewboard/hostingsvcs/github.py
        reviewboard/hostingsvcs/googlecode.py
        reviewboard/hostingsvcs/tests/test_registration.py
        reviewboard/datagrids/urls.py
    
    
  2. reviewboard/hostingsvcs/beanstalk.py (Diff revision 3)
     
     
    Col: 80
     E501 line too long (81 > 79 characters)
    
  3. reviewboard/hostingsvcs/github.py (Diff revision 3)
     
     
    Col: 80
     E501 line too long (80 > 79 characters)
    
  4. reviewboard/hostingsvcs/github.py (Diff revision 3)
     
     
    Col: 80
     E501 line too long (81 > 79 characters)
    
  5. reviewboard/hostingsvcs/googlecode.py (Diff revision 3)
     
     
    Col: 80
     E501 line too long (81 > 79 characters)
    
  6. reviewboard/hostingsvcs/googlecode.py (Diff revision 3)
     
     
    Col: 80
     E501 line too long (81 > 79 characters)
    
  7. reviewboard/reviews/urls.py (Diff revision 3)
     
     
    Col: 80
     E501 line too long (80 > 79 characters)
    
  8. 
      
David Trowbridge
Review Bot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/scmtools/admin.py
        reviewboard/hostingsvcs/urls.py
        reviewboard/hostingsvcs/beanstalk.py
        reviewboard/accounts/urls.py
        reviewboard/reviews/urls.py
        reviewboard/hostingsvcs/bitbucket.py
        reviewboard/admin/urls.py
        reviewboard/urls.py
        reviewboard/hostingsvcs/service.py
        reviewboard/search/urls.py
        reviewboard/hostingsvcs/github.py
        reviewboard/hostingsvcs/googlecode.py
        reviewboard/hostingsvcs/tests/test_registration.py
        reviewboard/datagrids/urls.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/scmtools/admin.py
        reviewboard/hostingsvcs/urls.py
        reviewboard/hostingsvcs/beanstalk.py
        reviewboard/accounts/urls.py
        reviewboard/reviews/urls.py
        reviewboard/hostingsvcs/bitbucket.py
        reviewboard/admin/urls.py
        reviewboard/urls.py
        reviewboard/hostingsvcs/service.py
        reviewboard/search/urls.py
        reviewboard/hostingsvcs/github.py
        reviewboard/hostingsvcs/googlecode.py
        reviewboard/hostingsvcs/tests/test_registration.py
        reviewboard/datagrids/urls.py
    
    
  2. 
      
David Trowbridge
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.0.x (151c59d6b).

Loading...