~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to docs/ref/files/storage.txt

  • Committer: Package Import Robot
  • Author(s): Raphaël Hertzog
  • Date: 2014-09-17 14:15:11 UTC
  • mfrom: (1.3.17) (6.2.18 experimental)
  • Revision ID: package-import@ubuntu.com-20140917141511-icneokthe9ww5sk4
Tags: 1.7-2
* Release to unstable.
* Add a migrate-south sample script to help users apply their South
  migrations. Thanks to Brian May.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
The FileSystemStorage Class
30
30
---------------------------
31
31
 
32
 
.. class:: FileSystemStorage
 
32
.. class:: FileSystemStorage([location=None, base_url=None, file_permissions_mode=None, directory_permissions_mode=None])
33
33
 
34
34
    The :class:`~django.core.files.storage.FileSystemStorage` class implements
35
35
    basic file storage on a local filesystem. It inherits from
36
36
    :class:`~django.core.files.storage.Storage` and provides implementations
37
37
    for all the public methods thereof.
38
38
 
 
39
    .. attribute:: location
 
40
 
 
41
        Absolute path to the directory that will hold the files.
 
42
        Defaults to the value of your :setting:`MEDIA_ROOT` setting.
 
43
 
 
44
    .. attribute:: base_url
 
45
 
 
46
        URL that serves the files stored at this location.
 
47
        Defaults to the value of your :setting:`MEDIA_URL` setting.
 
48
 
 
49
    .. attribute:: file_permissions_mode
 
50
 
 
51
        The file system permissions that the file will receive when it is
 
52
        saved. Defaults to :setting:`FILE_UPLOAD_PERMISSIONS`.
 
53
 
 
54
        .. versionadded:: 1.7
 
55
 
 
56
            The ``file_permissions_mode`` attribute was added. Previously files
 
57
            always received :setting:`FILE_UPLOAD_PERMISSIONS` permissions.
 
58
 
 
59
    .. attribute:: directory_permissions_mode
 
60
 
 
61
        The file system permissions that the directory will receive when it is
 
62
        saved. Defaults to :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS`.
 
63
 
 
64
        .. versionadded:: 1.7
 
65
 
 
66
            The ``directory_permissions_mode`` attribute was added. Previously
 
67
            directories always received
 
68
            :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS` permissions.
 
69
 
39
70
    .. note::
40
71
 
41
72
        The ``FileSystemStorage.delete()`` method will not raise
81
112
        available for new content to be written to on the target storage
82
113
        system.
83
114
 
84
 
        .. versionchanged:: 1.6.6
 
115
        .. versionchanged:: 1.7
85
116
 
86
117
        If a file with ``name`` already exists, an underscore plus a random 7
87
118
        character alphanumeric string is appended to the filename before the
88
119
        extension.
89
120
 
90
121
        Previously, an underscore followed by a number (e.g. ``"_1"``, ``"_2"``,
91
 
        etc.) was appended to the filename until an avaible name in the
 
122
        etc.) was appended to the filename until an available name in the
92
123
        destination directory was found. A malicious user could exploit this
93
124
        deterministic algorithm to create a denial-of-service attack. This
94
 
        change was also made in Django 1.5.9 and 1.4.14.
 
125
        change was also made in Django 1.6.6, 1.5.9, and 1.4.14.
95
126
 
96
127
    .. method:: get_valid_name(name)
97
128