Review Board

beta

Add dynamic site configuration to Review Board

Submitted
Updated 2 months, 2 weeks ago

Christian Hammond Reviewers
trunk reviewboard
None Review Board SVN
Up until now users have had to edit settings_local.py to customize their Review Board install. While we documented many of the options, it was still a pain for users as they'd have to log in and edit the file and then restart the server.

With the new djblets.siteconfig app, we can now move in a more modern direction for customization of Review Board. Aside from a few basic essential settings in settings_local.py (such as database configuration) the admin UI will now be the place to go to customize Review Board.

A migration script is provided to automatically migrate all settings into the new siteconfig database entry. The next time users run ./manage.py syncdb, the script will detect that the settings need to be migrated and handle it all. Everything we care about should be preserved, including authentication information.
I've tested this with brand new installs and with a few different migrated databases. I haven't hit any problems yet but I haven't actually tested the resulting settings for authentication. Users can specify NIS or LDAP servers and I know we save the information but before this goes in, I'll be testing on an actual install.
Posted 3 months, 3 weeks ago (July 31st, 2008, 11:58 p.m.)
This looks awesome.  Do you have some screenshots of the UI?
  1. Christian Hammond 3 months, 3 weeks ago (August 1st, 2008, 3:19 a.m.)
    Will add some.
/trunk/reviewboard/accounts/views.py (Diff revision 1)
11
I don't think this line belongs here in the standard style for these.
  1. Christian Hammond 3 months, 3 weeks ago (August 1st, 2008, 3:18 a.m.)
    Fixed.
/trunk/reviewboard/admin/forms.py (Diff revision 1)
132
        if "://" in server:
133
            domain_method, domain_name = server.split("://", 2)
134
135
            # Strip off any trailing path on the domain.
136
            domain_name = domain_name.split("/")[0]
Seems like the urlparse module is appropriate.  Note that if you do this, we need to use tuple indices instead of names, because the names were only added in python 2.5.
  1. Christian Hammond 3 months, 3 weeks ago (August 1st, 2008, 3:18 a.m.)
    Fixed.
/trunk/reviewboard/manage.py (Diff revision 1)
53
    # pygments
54
    if settings.DIFF_SYNTAX_HIGHLIGHTING:
55
        try:
56
            import pygments
57
            version = pygments.__version__.split(".")
58
            if version[0] == 0 and version[1] < 9:
59
                dependency_error('Pygments is installed, but is an old version. '
60
                                 'Versions prior to 0.9 are known to have '
61
                                 'serious problems.')
62
        except ImportError:
63
            dependency_error('The Pygments library is required when ' +
64
                             'DIFF_SYNTAX_HIGHLIGHTING is enabled.')
65
66
    # PyLucene
67
    if settings.ENABLE_SEARCH:
68
        try:
69
            import lucene
70
        except ImportError:
71
            dependency_error('PyLucene (with JCC) is required when '
72
                             'ENABLE_SEARCH is set.')
Instead of killing these, could you move them down and make them dependency_warning()s? This should let you remove your TODO by the forms for these too.
  1. Christian Hammond 3 months, 3 weeks ago (August 1st, 2008, 3:18 a.m.)
    It won't really because I want something that admins will see on Review Board itself, maybe at the top of the page when they log in.
    
    It's also too soon to check for this because the database and settings aren't set up properly yet.
    
    I'll put a change together soon that addresses this in another way. For now, people will just see that it doesn't work and will see the messages in the settings UI.
  2. David Trowbridge 3 months, 2 weeks ago (August 1st, 2008, 9:50 p.m.)
    I don't mean you shouldn't keep the one in the settings stuff, just have a dependency warning here so people can run the checks and see everything at once.
  3. Christian Hammond 3 months, 2 weeks ago (August 1st, 2008, 10:09 p.m.)
    I get that, but they wouldn't be dependent on the actual  settings anymore. We'd have to always show the warning if it doesn't exist, unlike the old code that checks first. Is that alright with you? I think it can be annoying since I don't use search on my local install and I really don't want to see it every time, so I think it should be setting-dependent but again we can't query for that at this stage.
  4. David Trowbridge 3 months, 2 weeks ago (August 1st, 2008, 10:10 p.m.)
    Yeah.  We show similar warnings for things like perforce, even though not everyone will use it.
Posted 3 months, 1 week ago (August 11th, 2008, 8:54 p.m.)

   

  
/trunk/reviewboard/accounts/urls.py (Diff revision 3)
1
from django.conf import settings
Need to add file to accounts/Makefile.am
/trunk/reviewboard/admin/forms.py (Diff revision 3)
1
import os.path
Need to add file to admin/Makefile.am

Same goes for other new files in this directory:

 - siteconfig.pc
 - management sub directory
/trunk/reviewboard/templates/admin/general_settings.html (Diff revision 3)
1
{% extends "admin/settings.html" %}
Needs to be added to templates/Makefile.am

Same goes for templates/admin/general_settings/html