|
1 | 1 | import os |
2 | 2 | import time |
| 3 | +from textwrap import dedent |
3 | 4 |
|
4 | 5 | from django.conf import settings |
5 | 6 | from django.core import checks |
@@ -209,3 +210,32 @@ def cache_error(msg, errnum): |
209 | 210 | errors.append(cache_error("Cache didn't accept session cookie age", "E0016")) |
210 | 211 | return errors |
211 | 212 |
|
| 213 | +@checks.register('cache') |
| 214 | +def check_svn_import(app_configs, **kwargs): |
| 215 | + errors = [] |
| 216 | + if settings.SERVER_MODE == 'production': |
| 217 | + try: |
| 218 | + import svn # pyflakes:ignore |
| 219 | + except ImportError as e: |
| 220 | + errors.append(checks.Critical( |
| 221 | + "Could not import the python svn module:\n %s\n" % e, |
| 222 | + hint = dedent(""" |
| 223 | + You are running in production mode, and the subversion bindings for python |
| 224 | + are necessary in order to run the Trac wiki glue scripts. |
| 225 | +
|
| 226 | + However, the subversion bindings seem to be unavailable. The subversion |
| 227 | + bindings are not available for install using pip, but must be supplied by |
| 228 | + the system package manager. In order to be available within a python |
| 229 | + virtualenv, the virtualenv must have been created with the |
| 230 | + --system-site-packages flag, so that the packages installed by the system |
| 231 | + package manager are visible. |
| 232 | +
|
| 233 | + Please install 'python-subversion' (Debian), 'subversion-python' (RedHat, |
| 234 | + CentOS, Fedora), 'subversion-python27bindings' (BSD); and set up a |
| 235 | + virtualenv using the --system-site-packages flag. Further tips are |
| 236 | + available at https://trac.edgewall.org/wiki/TracSubversion. |
| 237 | +
|
| 238 | + """).replace('\n', '\n ').rstrip(), |
| 239 | + id = "datatracker.E0014", |
| 240 | + )) |
| 241 | + return errors |
0 commit comments