Show an "Updates Required" page when we require manual updates from the administrator
Updated 9 months, 2 weeks ago
| Christian Hammond | Reviewers | ||
| trunk | reviewboard | ||
| None | Review Board SVN | ||
There are unfortunately times when upgrading Review Board is not as simple as running "svn up." We've so far been unhelpful with this. Now that we're going to require some changes for the media locations and users aren't necessarily going to see the message on the listserv, I felt we should have a nice way of communicating to the user. This change introduces the ability to add checks on startup. These may include schema changes in the future, but right now they check if the media setup is what we expect. If not, an error page is displayed with helpful information. Once the user fixes the problem and restarts Review Board, the normal URLs will be activated. This can also be useful for first-time users who currently have very little aid.
Tried this change with a branch using the old media setup and saw that it told me how to fix the problem instead of taking me to any URLs. Tried it on a branch with the new media setup and Review Board operated as normal.
Diff revision 1 (Latest)
- /trunk/reviewboard/settings.py: 2 changes [ 1 2 ]
- /trunk/reviewboard/urls.py: 6 changes [ 1 2 3 4 5 6 ]
- /trunk/reviewboard/admin/checks.py: 1 change [ new content ]
- /trunk/reviewboard/admin/views.py: 1 change [ new content ]
- /trunk/reviewboard/templates/admin/manual_updates_required.html: 1 change [ new content ]
- /trunk/reviewboard/templates/admin/manual-updates/media-upload-dir.html: 1 change [ new content ]
| /trunk/reviewboard/settings.py | |||
|---|---|---|---|
| Revision 1233 | New Change | ||
| 1 |
|
1 |
|
| 2 | 2 | ||
| 3 | import os |
3 | import os |
| 4 | import sys |
4 | import sys |
| 5 | 5 | ||
| 6 | |||
| 6 | DEBUG = True |
7 | DEBUG = True |
| 7 | 8 | ||
| 8 | ADMINS = ( |
9 | ADMINS = ( |
| 9 | ('Example Joe', 'admin@example.com') |
10 | ('Example Joe', 'admin@example.com') |
| 10 | ) |
11 | ) |
| ... | 74 lines hidden [Expand] | ||
| 85 | 'django.contrib.sessions', |
86 | 'django.contrib.sessions', |
| 86 | 'djblets.datagrid', |
87 | 'djblets.datagrid', |
| 87 | 'djblets.util', |
88 | 'djblets.util', |
| 88 | 'djblets.webapi', |
89 | 'djblets.webapi', |
| 89 | 'reviewboard.accounts', |
90 | 'reviewboard.accounts', |
| 91 | 'reviewboard.admin', |
||
| 90 | 'reviewboard.diffviewer', |
92 | 'reviewboard.diffviewer', |
| 91 | 'reviewboard.iphone', |
93 | 'reviewboard.iphone', |
| 92 | 'reviewboard.reports', |
94 | 'reviewboard.reports', |
| 93 | 'reviewboard.reviews', |
95 | 'reviewboard.reviews', |
| 94 | 'reviewboard.scmtools', |
96 | 'reviewboard.scmtools', |
| ... | 92 lines hidden [Expand] | ||
| /trunk/reviewboard/urls.py | |||
|---|---|---|---|
| Revision 1233 | New Change | ||
| 1 |
|
1 |
|
| 2 | 2 | ||
| 3 | from django.conf import settings |
3 | from django.conf import settings |
| 4 | from django.conf.urls.defaults import patterns, include, handler404, handler500 |
4 | from django.conf.urls.defaults import patterns, include, handler404, handler500 |
| 5 | 5 | ||
| 6 | from reviewboard.admin.checks import check_updates_required |
||
| 6 | from reviewboard.reviews.feeds import RssReviewsFeed, AtomReviewsFeed, \ |
7 | from reviewboard.reviews.feeds import RssReviewsFeed, AtomReviewsFeed, \ |
| 7 | RssSubmitterReviewsFeed, \ |
8 | RssSubmitterReviewsFeed, \ |
| 8 | AtomSubmitterReviewsFeed, \ |
9 | AtomSubmitterReviewsFeed, \ |
| 9 | RssGroupReviewsFeed, \ |
10 | RssGroupReviewsFeed, \ |
| 10 | AtomGroupReviewsFeed |
11 | AtomGroupReviewsFeed |
| 11 | 12 | ||
| 12 | 13 | ||
| 14 | # URLs global to all modes |
||
| 15 | urlpatterns = patterns('', |
||
| 16 | (r'^admin/', include('django.contrib.admin.urls')), |
||
| 17 | ) |
||
| 18 | |||
| 19 | # Add static media if running in DEBUG mode |
||
| 20 | if settings.DEBUG: |
||
| 21 | def htdocs_path(leaf): |
||
| 22 | return os.path.join(settings.HTDOCS_ROOT, leaf) |
||
| 23 | |||
| 24 | urlpatterns += patterns('django.views.static', |
||
| 25 | (r'^css/(?P<path>.*)$', 'serve', { |
||
| 26 | 'show_indexes': True, |
||
| 27 | 'document_root': htdocs_path('css'), |
||
| 28 | }), |
||
| 29 | (r'^images/(?P<path>.*)$', 'serve', { |
||
| 30 | 'show_indexes': True, |
||
| 31 | 'document_root': htdocs_path('images'), |
||
| 32 | }), |
||
| 33 | (r'^scripts/(?P<path>.*)$', 'serve', { |
||
| 34 | 'show_indexes': True, |
||
| 35 | 'document_root': htdocs_path('scripts') |
||
| 36 | }), |
||
| 37 | ) |
||
| 38 | |||
| 39 | |||
| 40 | # Check that we're actually able to run. There may have been changes that |
||
| 41 | # require the user to manually update things on the server and restart. |
||
| 42 | if check_updates_required(): |
||
| 43 | # There's updates required. Disable the main URLs for now, since it might |
||
| 44 | # be useless. |
||
| 45 | |||
| 46 | urlpatterns += patterns('', |
||
| 47 | (r'^.*', 'reviewboard.admin.views.manual_updates_required'), |
||
| 48 | ) |
||
| 49 | else: |
||
| 13 | rss_feeds = { |
50 | rss_feeds = { |
| 14 | 'r': RssReviewsFeed, |
51 | 'r': RssReviewsFeed, |
| 15 | 'users': RssSubmitterReviewsFeed, |
52 | 'users': RssSubmitterReviewsFeed, |
| 16 | 'groups': RssGroupReviewsFeed, |
53 | 'groups': RssGroupReviewsFeed, |
| 17 | } |
54 | } |
| ... | 5 lines hidden [Expand] | ||
| 23 | 'groups': AtomGroupReviewsFeed, |
60 | 'groups': AtomGroupReviewsFeed, |
| 24 | } |
61 | } |
| 25 | 62 | ||
| 26 | 63 | ||
| 27 | # Main includes |
64 | # Main includes |
| 28 | urlpatterns = patterns('', |
65 | urlpatterns += patterns('', |
| 29 | (r'^admin/', include('django.contrib.admin.urls')), |
66 | (r'^admin/', include('django.contrib.admin.urls')), |
| 30 | (r'^api/json/', include('reviewboard.webapi.urls')), |
67 | (r'^api/json/', include('reviewboard.webapi.urls')), |
| 31 | (r'^r/', include('reviewboard.reviews.urls')), |
68 | (r'^r/', include('reviewboard.reviews.urls')), |
| 32 | (r'^reports/', include('reviewboard.reports.urls')), |
69 | (r'^reports/', include('reviewboard.reports.urls')), |
| 33 | ) |
70 | ) |
| ... | 26 lines hidden [Expand] | ||
| 60 | ) |
97 | ) |
| 61 | 98 | ||
| 62 | 99 | ||
| 63 | # And the rest ... |
100 | # And the rest ... |
| 64 | urlpatterns += patterns('', |
101 | urlpatterns += patterns('', |
| 65 | (r'^$', 'django.views.generic.simple.redirect_to', {'url': 'dashboard/'}), |
102 | (r'^$', 'django.views.generic.simple.redirect_to', |
| 103 | {'url': 'dashboard/'}), |
||
| 66 | 104 | ||
| 67 | # Authentication and accounts |
105 | # Authentication and accounts |
| 68 | (r'^account/login/$', 'djblets.auth.views.login', |
106 | (r'^account/login/$', 'djblets.auth.views.login', |
| 69 | {'next_page': settings.SITE_ROOT + 'dashboard/', |
107 | {'next_page': settings.SITE_ROOT + 'dashboard/', |
| 70 | 'extra_context': {'BUILTIN_AUTH': settings.BUILTIN_AUTH}}), |
108 | 'extra_context': {'BUILTIN_AUTH': settings.BUILTIN_AUTH}}), |
| ... | 11 lines hidden [Expand] | ||
| 82 | else: |
120 | else: |
| 83 | urlpatterns += patterns('', |
121 | urlpatterns += patterns('', |
| 84 | (r'^account/register/$', |
122 | (r'^account/register/$', |
| 85 | 'django.views.generic.simple.redirect_to', |
123 | 'django.views.generic.simple.redirect_to', |
| 86 | {'url': settings.SITE_ROOT + 'account/login/'})) |
124 | {'url': settings.SITE_ROOT + 'account/login/'})) |
| 87 | |||
| 88 | |||
| 89 | # Add static media if running in DEBUG mode |
||
| 90 | if settings.DEBUG: |
||
| 91 | def htdocs_path(leaf): |
||
| 92 | return os.path.join(settings.HTDOCS_ROOT, leaf) |
||
| 93 | |||
| 94 | urlpatterns += patterns('django.views.static', |
||
| 95 | (r'^css/(?P<path>.*)$', 'serve', { |
||
| 96 | 'show_indexes': True, |
||
| 97 | 'document_root': htdocs_path('css'), |
||
| 98 | }), |
||
| 99 | (r'^images/(?P<path>.*)$', 'serve', { |
||
| 100 | 'show_indexes': True, |
||
| 101 | 'document_root': htdocs_path('images'), |
||
| 102 | }), |
||
| 103 | (r'^scripts/(?P<path>.*)$', 'serve', { |
||
| 104 | 'show_indexes': True, |
||
| 105 | 'document_root': htdocs_path('scripts') |
||
| 106 | }), |
||
| 107 | ) |
||
- /trunk/reviewboard/settings.py: 2 changes [ 1 2 ]
- /trunk/reviewboard/urls.py: 6 changes [ 1 2 3 4 5 6 ]
- /trunk/reviewboard/admin/checks.py: 1 change [ new content ]
- /trunk/reviewboard/admin/views.py: 1 change [ new content ]
- /trunk/reviewboard/templates/admin/manual_updates_required.html: 1 change [ new content ]
- /trunk/reviewboard/templates/admin/manual-updates/media-upload-dir.html: 1 change [ new content ]
Other reviews