Add LocalSite rooting for the Repository resources.

Review Request #1956 — Created Nov. 29, 2010 and submitted

Information

Review Board
master

Reviewers

Add LocalSite rooting for the Repository resources.

This change adds namespacing and unit tests for the RepositoryResource and
RepositoryInfoResource.

 
chipx86
  1. 
      
  2. reviewboard/webapi/resources.py (Diff revision 1)
     
     
     
     
    You should just be able to provide local_site_name=None in the argument list for the function.
  3. reviewboard/webapi/tests.py (Diff revision 1)
     
     
     
    Can we maybe define a const somewhere for the tests so we don't have to repeat "local-site-1" everywhere?
    1. Sure, I'll just add a class member.
  4. reviewboard/webapi/tests.py (Diff revision 1)
     
     
    This feels unsafe. If there's a particular Repository we're looking for, let's first fetch the Repository and then use the pk.
    1. Okay. It's still kind of arbitrary (since it's relying on knowledge of what's in the test fixtures), but I guess the name is less likely to change.
  5. reviewboard/webapi/tests.py (Diff revision 1)
     
     
    Same here with the repository ID.
  6. 
      
david
Review request changed
chipx86
  1. 
      
  2. reviewboard/webapi/resources.py (Diff revision 2)
     
     
    Remind me if I brought this up on another review request and there's an answer, because I really can't remember right now...
    
    If the name passed doesn't exist, should this be defaulting to the main site? Or should it cause a 404? Or are we already getting that from the decorators?
    
    If we're good, then ship it.
    1. We're getting that from the decorators. In fact, the decorator works such that none of this code will ever even execute.
  3. 
      
chipx86
  1. 
      
  2.