From 465833834c3c5fcd8180122df799ee41352ec13c Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 5 Jan 2011 12:41:40 +0000 Subject: [PATCH] Fixed a few docstrings and other helper texts in the staticfiles app. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15148 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/staticfiles/finders.py | 24 +++++++------------ .../management/commands/collectstatic.py | 5 ++-- .../management/commands/runserver.py | 2 +- django/contrib/staticfiles/storage.py | 4 ++-- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/django/contrib/staticfiles/finders.py b/django/contrib/staticfiles/finders.py index ccb826882a..2e7f8d9615 100644 --- a/django/contrib/staticfiles/finders.py +++ b/django/contrib/staticfiles/finders.py @@ -17,7 +17,6 @@ _finders = {} class BaseFinder(object): """ A base file finder to be used for custom staticfiles finder classes. - """ def find(self, path, all=False): """ @@ -62,7 +61,7 @@ class FileSystemFinder(BaseFinder): def find(self, path, all=False): """ - Looks for files in the extra media locations + Looks for files in the extra locations as defined in ``STATICFILES_DIRS``. """ matches = [] @@ -76,7 +75,7 @@ class FileSystemFinder(BaseFinder): def find_location(self, root, path, prefix=None): """ - Find a requested static file in a location, returning the found + Finds a requested static file in a location, returning the found absolute path (or ``None`` if no match). """ if prefix: @@ -100,7 +99,8 @@ class FileSystemFinder(BaseFinder): class AppDirectoriesFinder(BaseFinder): """ - A static files finder that looks in the ``media`` directory of each app. + A static files finder that looks in the directory of each app as + specified in the source_dir attribute of the given storage class. """ storage_class = AppStaticStorage @@ -140,7 +140,7 @@ class AppDirectoriesFinder(BaseFinder): def find_in_app(self, app, path): """ - Find a requested static file in an app's media locations. + Find a requested static file in an app's static locations. """ storage = self.storages[app] prefix = storage.get_prefix() @@ -207,16 +207,10 @@ class DefaultStorageFinder(BaseStorageFinder): def find(path, all=False): """ - Find a requested static file, first looking in any defined extra media - locations and next in any (non-excluded) installed apps. - - If no matches are found and the static location is local, look for a match - there too. - + Find a static file with the given path using all enabled finders. + If ``all`` is ``False`` (default), return the first matching - absolute path (or ``None`` if no match). Otherwise return a list of - found absolute paths. - + absolute path (or ``None`` if no match). Otherwise return a list. """ matches = [] for finder in get_finders(): @@ -237,7 +231,7 @@ def get_finders(): def _get_finder(import_path): """ - Imports the message storage class described by import_path, where + Imports the staticfiles finder class described by import_path, where import_path is the full Python path to the class. """ module, attr = import_path.rsplit('.', 1) diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py index 10f9fdd016..0037adc2c1 100644 --- a/django/contrib/staticfiles/management/commands/collectstatic.py +++ b/django/contrib/staticfiles/management/commands/collectstatic.py @@ -16,8 +16,7 @@ class Command(NoArgsCommand): """ option_list = NoArgsCommand.option_list + ( make_option('--noinput', action='store_false', dest='interactive', - default=True, help="Do NOT prompt the user for input of any " - "kind."), + default=True, help="Do NOT prompt the user for input of any kind."), make_option('-i', '--ignore', action='append', default=[], dest='ignore_patterns', metavar='PATTERN', help="Ignore files or directories matching this glob-style " @@ -69,7 +68,7 @@ Are you sure you want to do this? Type 'yes' to continue, or 'no' to cancel: """) if confirm != 'yes': - raise CommandError("Static files build cancelled.") + raise CommandError("Collecting static files cancelled.") # Use ints for file times (ticket #14665) os.stat_float_times(False) diff --git a/django/contrib/staticfiles/management/commands/runserver.py b/django/contrib/staticfiles/management/commands/runserver.py index f4c22598c3..c6e56d2b98 100644 --- a/django/contrib/staticfiles/management/commands/runserver.py +++ b/django/contrib/staticfiles/management/commands/runserver.py @@ -12,7 +12,7 @@ class Command(BaseRunserverCommand): make_option('--insecure', action="store_true", dest='insecure_serving', default=False, help='Allows serving static files even if DEBUG is False.'), ) - help = "Starts a lightweight Web server for development, including static files serving." + help = "Starts a lightweight Web server for development and also serves static files." def get_handler(self, *args, **options): """ diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py index 56e5c0dec0..ace35a190e 100644 --- a/django/contrib/staticfiles/storage.py +++ b/django/contrib/staticfiles/storage.py @@ -9,7 +9,7 @@ from django.contrib.staticfiles import utils class StaticFilesStorage(FileSystemStorage): """ - Standard file system storage for site media files. + Standard file system storage for static files. The defaults for ``location`` and ``base_url`` are ``STATIC_ROOT`` and ``STATIC_URL``. @@ -22,7 +22,7 @@ class StaticFilesStorage(FileSystemStorage): if not location: raise ImproperlyConfigured("You're using the staticfiles app " "without having set the STATIC_ROOT setting. Set it to " - "the absolute path of the directory that holds static media.") + "the absolute path of the directory that holds static files.") # check for None since we might use a root URL (``/``) if base_url is None: raise ImproperlyConfigured("You're using the staticfiles app "