796: post-review tool doesn't create a review if reviewboard was installed on a url that is not root at '/', e.g. '/reviews'

butc*****@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
Jan. 19, 2009
The post-review tool assumes that the reviewboard url is always at '/' e.g.
'http://reviews.example.com/'. If reviewboard was installed with a url like
'http://www.example.com/reviews/', the post-review tool cannot submit a new
 review.

What steps will reproduce the problem?

1. Install reviewboard on a url that is not at the root of the site:
In my case I installed it using the following modpython configuration:

        # Error handlers
        ErrorDocument 500 /errordocs/500.html

        # Serve django pages
        <Location "/reviewboard">
                PythonPath "['/srv/reviewboard/conf'] + sys.path"
                SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
                SetHandler mod_python
                PythonHandler django.core.handlers.modpython
                PythonAutoReload Off
                PythonDebug Off
                # Used to run multiple mod_python sites in the same apache
                PythonInterpreter reviewboard_reviewboard
        </Location>

        # Serve static media without running it through mod_python
        # (overrides the above)
        <Location "/media">
                SetHandler None
        </Location>
        <Location "/errordocs">
                SetHandler None
        </Location>

        # Alias static media requests to filesystem
        Alias /media /srv/reviewboard/htdocs/media
        Alias /errordocs /srv/reviewboard/htdocs/errordocs

2. Complete the reviewboard installation and configuration (including
simplejson on the client)

3. Try to submit a review using post-review with option 

    '--server=http://www.example.com/reviewboard'

where http://www.example.com/reviewboard is the url of your reviewboard site.

What is the expected output? What do you see instead?

It should have created a new draft review request. Instead it returns a 404
error message like the following:

'Unable to access http://www.example.com/api/json/repositories/ (404). The
host path may be invalid'
 

What operating system are you using? What browser?

This is on both Linux and windows. Browser is not relevant as I am using a
commandline tool.

Please provide any additional information below.

The error is due to the fact that its trying to look up 
'http://www.example.com/api/json/repositories' when it
should be looking up
'http://www.example.com/reviewboard/api/json/repositories'

I created a fix for it and have submitted for review.
#1 mino****@gmai***** (Google Code) (Is this you? Claim this profile.)
I am having this issue too, if you have a fix please let me know.
chipx86
#2 chipx86
The URL needs a trailing "/". Configure your server URL for this and it should work.

There's a patch that I thought we committed, but perhaps it's pending, that
guarantees a trailing "/" in all cases, but it's best to just set it up correctly.
#3 butc*****@gmai***** (Google Code) (Is this you? Claim this profile.)
FWIW, here's the patch I sent for review: http://reviews.review-board.org/r/689/

YMMV. :)

#4 mino****@gmai***** (Google Code) (Is this you? Claim this profile.)
that worked, thanks a million.
chipx86
#5 chipx86
Fixed in r1676.
  • +Fixed
  • +Milestone-Release1.0
    +Component-Scripts
  • +chipx86