Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
7a38e86b
Kaydet (Commit)
7a38e86b
authored
Kas 17, 2012
tarafından
Preston Holmes
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #19310 -- changed method docs formatting for custom file storage docs
üst
f7901384
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
custom-file-storage.txt
docs/howto/custom-file-storage.txt
+8
-11
No files found.
docs/howto/custom-file-storage.txt
Dosyayı görüntüle @
7a38e86b
...
...
@@ -27,9 +27,9 @@ You'll need to follow these steps:
option = settings.CUSTOM_STORAGE_OPTIONS
...
#. Your storage class must implement the
``_open()`` and ``_save()`` methods,
along with any other methods appropriate to your storage class. See below for
more on these methods.
#. Your storage class must implement the
:meth:`_open()` and :meth:`_save()
methods, along with any other methods appropriate to your storage class. See
below for
more on these methods.
In addition, if your class provides local file storage, it must override
the ``path()`` method.
...
...
@@ -46,8 +46,7 @@ Your custom storage system may override any of the storage methods explained in
You'll also usually want to use hooks specifically designed for custom storage
objects. These are:
``_open(name, mode='rb')``
~~~~~~~~~~~~~~~~~~~~~~~~~~
.. method:: _open(name, mode='rb')
**Required**.
...
...
@@ -56,8 +55,7 @@ uses to open the file. This must return a ``File`` object, though in most cases,
you'll want to return some subclass here that implements logic specific to the
backend storage system.
``_save(name, content)``
~~~~~~~~~~~~~~~~~~~~~~~~
.. method:: _save(name, content)
Called by ``Storage.save()``. The ``name`` will already have gone through
``get_valid_name()`` and ``get_available_name()``, and the ``content`` will be a
...
...
@@ -67,8 +65,8 @@ Should return the actual name of name of the file saved (usually the ``name``
passed in, but if the storage needs to change the file name return the new name
instead).
``get_valid_name(name)``
~~~~~~~~~~~~~~~~~~~~~~~~
.. method:: get_valid_name(name)
Returns a filename suitable for use with the underlying storage system. The
``name`` argument passed to this method is the original filename sent to the
...
...
@@ -78,8 +76,7 @@ how non-standard characters are converted to safe filenames.
The code provided on ``Storage`` retains only alpha-numeric characters, periods
and underscores from the original filename, removing everything else.
``get_available_name(name)``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. method:: get_available_name(name)
Returns a filename that is available in the storage mechanism, possibly taking
the provided filename into account. The ``name`` argument passed to this method
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment