Ticket #12699: stableversion.patch
File stableversion.patch, 2.2 KB (added by , 15 years ago) |
---|
-
djangodocs/views.py
12 12 return HttpResponseRedirect( 13 13 urlresolvers.reverse('document-index', kwargs={ 14 14 'lang': 'en', 15 'version': '1.1',15 'version': settings.STABLE_VERSION, 16 16 }) 17 17 ) 18 18 … … 20 20 return HttpResponseRedirect( 21 21 urlresolvers.reverse('document-index', kwargs={ 22 22 'lang': lang, 23 'version': '1.1',23 'version': settings.STABLE_VERSION, 24 24 }) 25 25 ) 26 26 27 def check_version(version): 28 return version == 'stable' and settings.STABLE_VERSION or version 29 27 30 def get_docroot(lang, version): 28 docroot = Path(settings.DOCS_PICKLE_ROOT).child(lang, version, "_build", "json")31 docroot = Path(settings.DOCS_PICKLE_ROOT).child(lang, check_version(version), "_build", "json") 29 32 if not docroot.exists(): 30 33 raise Http404() 31 34 return docroot 32 35 33 36 def document(request, lang, version, url): 37 version = check_version(version) 34 38 docroot = get_docroot(lang, version) 35 39 36 40 # First look for <bits>/index.fpickle, then for <bits>.fpickle … … 86 90 return response 87 91 88 92 def search(request, lang, version): 93 version = check_version(version) 89 94 docroot = get_docroot(lang, version) 90 95 91 96 # Remove the 'cof' GET variable from the query string so that the page … … 102 107 'env': simplejson.load(open(docroot.child('globalcontext.json'), 'rb')), 103 108 'home': urlresolvers.reverse('document-index', kwargs={'lang':lang, 'version':version}), 104 109 'search': urlresolvers.reverse('document-search', kwargs={'lang':lang, 'version':version}), 105 })) 106 No newline at end of file 110 })) -
djangodocs/settings.py
8 8 ROOT_URLCONF = 'djangodocs.urls' 9 9 CACHE_MIDDLEWARE_KEY_PREFIX = 'djangodocs' 10 10 11 DOCS_PICKLE_ROOT = "/home/djangodocs/"12 No newline at end of file 11 STABLE_VERSION = "1.1" 12 DOCS_PICKLE_ROOT = "/home/djangodocs/"