mirror of
https://github.com/django/django.git
synced 2025-08-01 17:42:56 +00:00
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11994 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
66ef91d02a
commit
adb74a8f2e
22 changed files with 59 additions and 63 deletions
|
@ -327,7 +327,7 @@ translates (roughly) into the following SQL::
|
|||
arguments whose names and values are evaluated at runtime. For more
|
||||
information, see `Keyword Arguments`_ in the official Python tutorial.
|
||||
|
||||
.. _`Keyword Arguments`: http://docs.python.org/tut/node6.html#SECTION006720000000000000000
|
||||
.. _`Keyword Arguments`: http://docs.python.org/tutorial/controlflow.html#keyword-arguments
|
||||
|
||||
If you pass an invalid keyword argument, a lookup function will raise
|
||||
``TypeError``.
|
||||
|
|
|
@ -251,5 +251,4 @@ necessary. (Also note that Django expects the ``"%s"`` placeholder, *not* the
|
|||
``"?"`` placeholder, which is used by the SQLite Python bindings. This is for
|
||||
the sake of consistency and sanity.)
|
||||
|
||||
.. _Python DB-API: http://www.python.org/peps/pep-0249.html
|
||||
|
||||
.. _Python DB-API: http://www.python.org/dev/peps/pep-0249/
|
||||
|
|
|
@ -55,7 +55,7 @@ Internally, Django uses a ``django.core.files.File`` any time it needs to
|
|||
represent a file. This object is a thin wrapper around Python's `built-in file
|
||||
object`_ with some Django-specific additions.
|
||||
|
||||
.. _built-in file object: http://docs.python.org/lib/bltin-file-objects.html
|
||||
.. _built-in file object: http://docs.python.org/library/stdtypes.html#bltin-file-objects
|
||||
|
||||
Most of the time you'll simply use a ``File`` that Django's given you (i.e. a
|
||||
file attached to a model as above, or perhaps an uploaded file).
|
||||
|
|
|
@ -30,7 +30,7 @@ is a dictionary containing a key for each ``FileField`` (or ``ImageField``, or
|
|||
other ``FileField`` subclass) in the form. So the data from the above form would
|
||||
be accessible as ``request.FILES['file']``.
|
||||
|
||||
Note that ``request.FILES`` will only contain data if the request method was
|
||||
Note that ``request.FILES`` will only contain data if the request method was
|
||||
``POST`` and the ``<form>`` that posted the request has the attribute
|
||||
``enctype="multipart/form-data"``. Otherwise, ``request.FILES`` will be empty.
|
||||
|
||||
|
@ -140,19 +140,19 @@ Three settings control Django's file upload behavior:
|
|||
|
||||
Defaults to your system's standard temporary directory (i.e. ``/tmp`` on
|
||||
most Unix-like systems).
|
||||
|
||||
|
||||
:setting:`FILE_UPLOAD_PERMISSIONS`
|
||||
The numeric mode (i.e. ``0644``) to set newly uploaded files to. For
|
||||
more information about what these modes mean, see the `documentation for
|
||||
os.chmod`_
|
||||
|
||||
|
||||
If this isn't given or is ``None``, you'll get operating-system
|
||||
dependent behavior. On most platforms, temporary files will have a mode
|
||||
of ``0600``, and files saved from memory will be saved using the
|
||||
system's standard umask.
|
||||
|
||||
|
||||
.. warning::
|
||||
|
||||
|
||||
If you're not familiar with file modes, please note that the leading
|
||||
``0`` is very important: it indicates an octal number, which is the
|
||||
way that modes must be specified. If you try to use ``644``, you'll
|
||||
|
@ -173,7 +173,7 @@ Three settings control Django's file upload behavior:
|
|||
Which means "try to upload to memory first, then fall back to temporary
|
||||
files."
|
||||
|
||||
.. _documentation for os.chmod: http://docs.python.org/lib/os-file-dir.html
|
||||
.. _documentation for os.chmod: http://docs.python.org/library/os.html#os.chmod
|
||||
|
||||
``UploadedFile`` objects
|
||||
========================
|
||||
|
@ -197,17 +197,17 @@ define the following methods/attributes:
|
|||
``UploadedFile.temporary_file_path()``
|
||||
Only files uploaded onto disk will have this method; it returns the full
|
||||
path to the temporary uploaded file.
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
Like regular Python files, you can read the file line-by-line simply by
|
||||
iterating over the uploaded file:
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
||||
for line in uploadedfile:
|
||||
do_something_with(line)
|
||||
|
||||
|
||||
However, *unlike* standard Python files, :class:`UploadedFile` only
|
||||
understands ``\n`` (also known as "Unix-style") line endings. If you know
|
||||
that you need to handle uploaded files with different line endings, you'll
|
||||
|
|
|
@ -53,7 +53,7 @@ for each platform.
|
|||
|
||||
.. _Apache: http://httpd.apache.org/
|
||||
.. _mod_wsgi: http://code.google.com/p/modwsgi/
|
||||
.. _WSGI: http://www.python.org/peps/pep-0333.html
|
||||
.. _WSGI: http://www.python.org/dev/peps/pep-0333/
|
||||
.. _server-arrangements wiki page: http://code.djangoproject.com/wiki/ServerArrangements
|
||||
|
||||
.. _database-installation:
|
||||
|
@ -125,7 +125,7 @@ Django will need permission to create a test database.
|
|||
.. _compiled Windows version: http://stickpeople.com/projects/python/win-psycopg/
|
||||
.. _MySQLdb: http://sourceforge.net/projects/mysql-python
|
||||
.. _SQLite: http://www.sqlite.org/
|
||||
.. _pysqlite: http://pysqlite.org/
|
||||
.. _pysqlite: http://trac.edgewall.org/wiki/PySqlite
|
||||
.. _cx_Oracle: http://cx-oracle.sourceforge.net/
|
||||
.. _Oracle: http://www.oracle.com/
|
||||
.. _Sybase SQL Anywhere: http://code.google.com/p/sqlany-django/
|
||||
|
|
|
@ -147,7 +147,7 @@ as must have ``CREATE DATABASE`` rights.
|
|||
For more details about how doctest works, see the `standard library
|
||||
documentation for doctest`_.
|
||||
|
||||
.. _doctest: http://docs.python.org/lib/module-doctest.html
|
||||
.. _doctest: http://docs.python.org/library/doctest.html
|
||||
.. _standard library documentation for doctest: doctest_
|
||||
|
||||
Writing unit tests
|
||||
|
@ -197,9 +197,9 @@ suite.
|
|||
For more details about ``unittest``, see the `standard library unittest
|
||||
documentation`_.
|
||||
|
||||
.. _unittest: http://docs.python.org/lib/module-unittest.html
|
||||
.. _unittest: http://docs.python.org/library/unittest.html
|
||||
.. _standard library unittest documentation: unittest_
|
||||
.. _suggested organization: http://docs.python.org/lib/organizing-tests.html
|
||||
.. _suggested organization: http://docs.python.org/library/unittest.html#organizing-tests
|
||||
|
||||
Which should I use?
|
||||
-------------------
|
||||
|
@ -414,7 +414,7 @@ a different focus. In short:
|
|||
A comprehensive test suite should use a combination of both test types.
|
||||
|
||||
.. _Twill: http://twill.idyll.org/
|
||||
.. _Selenium: http://www.openqa.org/selenium/
|
||||
.. _Selenium: http://seleniumhq.org/
|
||||
|
||||
Overview and a quick example
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -467,8 +467,8 @@ Note a few important things about how the test client works:
|
|||
This black magic (essentially a patching of Django's template system in
|
||||
memory) only happens during test running.
|
||||
|
||||
.. _urllib: http://docs.python.org/lib/module-urllib.html
|
||||
.. _urllib2: http://docs.python.org/lib/module-urllib2.html
|
||||
.. _urllib: http://docs.python.org/library/urllib.html
|
||||
.. _urllib2: http://docs.python.org/library/urllib2.html
|
||||
|
||||
Making requests
|
||||
~~~~~~~~~~~~~~~
|
||||
|
@ -809,7 +809,7 @@ can access these properties as part of a test condition.
|
|||
A dictionary-like object containing session information. See the
|
||||
:ref:`session documentation<topics-http-sessions>` for full details.
|
||||
|
||||
.. _Cookie module documentation: http://docs.python.org/lib/module-Cookie.html
|
||||
.. _Cookie module documentation: http://docs.python.org/library/cookie.html
|
||||
|
||||
Example
|
||||
~~~~~~~
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue