Convert URL patterns to lists.

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

Information

Review Board
release-3.0.x
c2417de...

Reviewers

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.

Description From Last Updated

Instead of importing each view directly, I'm wondering about just importing views as appname_views (reviews_views, admin_views, etc.). Then we can …

chipx86chipx86

One blank line, for consistency with the above.

chipx86chipx86

I don't love having to mix these throughout the file, but I also never quite loved some of these being …

chipx86chipx86

Mind removing these blank lines before except while here?

chipx86chipx86

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

chipx86chipx86

Swap these.

chipx86chipx86

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (80 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (80 > 79 characters)

reviewbotreviewbot
reviewbot
  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. 
      
chipx86
  1. 
      
  2. reviewboard/urls.py (Diff revision 1)
     
     
     
    Show all issues

    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
reviewbot
  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. 
      
brennie
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. reviewboard/datagrids/urls.py (Diff revision 2)
     
     
     
     
     
    Show all issues

    One blank line, for consistency with the above.

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

    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)
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Mind removing these blank lines before except while here?

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

    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)
     
     
     
    Show all issues

    Swap these.

  7. 
      
david
reviewbot
  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)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  3. reviewboard/hostingsvcs/github.py (Diff revision 3)
     
     
    Show all issues
    Col: 80
     E501 line too long (80 > 79 characters)
    
  4. reviewboard/hostingsvcs/github.py (Diff revision 3)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  5. reviewboard/hostingsvcs/googlecode.py (Diff revision 3)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  6. reviewboard/hostingsvcs/googlecode.py (Diff revision 3)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  7. reviewboard/reviews/urls.py (Diff revision 3)
     
     
    Show all issues
    Col: 80
     E501 line too long (80 > 79 characters)
    
  8. 
      
david
reviewbot
  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
Review request changed

Status: Closed (submitted)

Change Summary:

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

Loading...