diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-11-06 21:54:37 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-11-06 21:54:37 +0000 |
| commit | f6ce403140995adfec8492bf31a98edbe1f15b1b (patch) | |
| tree | f9c5e1c503a89409ccfbd26ed58fb69559aa44ae | |
| parent | 24f666656f482d567827f148a024b3c59fb5e4f0 (diff) | |
Small docstring change to django.views.static
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/views/static.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/django/views/static.py b/django/views/static.py index facc19fbb7..f74570c307 100644 --- a/django/views/static.py +++ b/django/views/static.py @@ -10,25 +10,25 @@ from django.core.template import Template, Context, TemplateDoesNotExist def serve(request, path, document_root=None, show_indexes=False): """ Serve static files below a given point in the directory structure. - - To use, put a URL pattern like:: - + + To use, put a URL pattern such as:: + (r'^(?P<path>.*)$', 'django.views.static.serve', {'document_root' : '/path/to/my/files/'}) - - in your URL conf; you must provide the ``document_root`` param. You may + + in your URLconf. You must provide the ``document_root`` param. You may also set ``show_indexes`` to ``True`` if you'd like to serve a basic index of the directory. This index view will use the template hardcoded below, but if you'd like to override it, you can create a template called ``static/directory_index``. """ - + # Clean up given path to only allow serving files below document_root. path = posixpath.normpath(urllib.unquote(path)) newpath = '' for part in path.split('/'): if not part: # strip empty path components - continue + continue drive, part = os.path.splitdrive(part) head, part = os.path.split(part) if part in (os.curdir, os.pardir): @@ -67,7 +67,7 @@ DEFAULT_DIRECTORY_INDEX_TEMPLATE = """ </body> </html> """ - + def directory_index(path, fullpath): try: t = template_loader.get_template('static/directory_index') |
