mirror of https://github.com/python/cpython
Fixing broken links in doc, part 2: howto/
This commit is contained in:
parent
77fe77d4af
commit
9bdcb3bc8a
|
@ -543,7 +543,7 @@ learn more about submitting patches to Python.
|
|||
|
||||
* `Writing Programs with NCURSES <http://invisible-island.net/ncurses/ncurses-intro.html>`_:
|
||||
a lengthy tutorial for C programmers.
|
||||
* `The ncurses man page <http://www.linuxmanpages.com/man3/ncurses.3x.php>`_
|
||||
* `The ncurses man page <http://linux.die.net/man/3/ncurses>`_
|
||||
* `The ncurses FAQ <http://invisible-island.net/ncurses/ncurses.faq.html>`_
|
||||
* `"Use curses... don't swear" <http://www.youtube.com/watch?v=eN1eZtjLEnU>`_:
|
||||
video of a PyCon 2013 talk on controlling terminals using curses or Urwid.
|
||||
|
|
|
@ -127,7 +127,7 @@ The implementation details are in :c:func:`super_getattro()` in
|
|||
:source:`Objects/typeobject.c`. and a pure Python equivalent can be found in
|
||||
`Guido's Tutorial`_.
|
||||
|
||||
.. _`Guido's Tutorial`: https://www.python.org/2.2.3/descrintro.html#cooperation
|
||||
.. _`Guido's Tutorial`: https://www.python.org/download/releases/2.2.3/descrintro/#cooperation
|
||||
|
||||
The details above show that the mechanism for descriptors is embedded in the
|
||||
:meth:`__getattribute__()` methods for :class:`object`, :class:`type`, and
|
||||
|
|
|
@ -86,11 +86,11 @@ that you can make sure that you detect breakage during the transition. Tests als
|
|||
tend to be simpler than the code they are testing so it gives you an idea of how
|
||||
easy it can be to port code.
|
||||
|
||||
Drop support for older Python versions if possible. `Python 2.5`_
|
||||
Drop support for older Python versions if possible. Python 2.5
|
||||
introduced a lot of useful syntax and libraries which have become idiomatic
|
||||
in Python 3. `Python 2.6`_ introduced future statements which makes
|
||||
in Python 3. Python 2.6 introduced future statements which makes
|
||||
compatibility much easier if you are going from Python 2 to 3.
|
||||
`Python 2.7`_ continues the trend in the stdlib. Choose the newest version
|
||||
Python 2.7 continues the trend in the stdlib. Choose the newest version
|
||||
of Python which you believe can be your minimum support version
|
||||
and work from there.
|
||||
|
||||
|
@ -144,19 +144,19 @@ for you.
|
|||
Support Python 2.7
|
||||
//////////////////
|
||||
|
||||
As a first step, make sure that your project is compatible with `Python 2.7`_.
|
||||
As a first step, make sure that your project is compatible with Python 2.7.
|
||||
This is just good to do as Python 2.7 is the last release of Python 2 and thus
|
||||
will be used for a rather long time. It also allows for use of the ``-3`` flag
|
||||
to Python to help discover places in your code where compatibility might be an
|
||||
issue (the ``-3`` flag is in Python 2.6 but Python 2.7 adds more warnings).
|
||||
|
||||
Try to Support `Python 2.6`_ and Newer Only
|
||||
///////////////////////////////////////////
|
||||
Try to Support Python 2.6 and Newer Only
|
||||
////////////////////////////////////////
|
||||
|
||||
While not possible for all projects, if you can support `Python 2.6`_ and newer
|
||||
While not possible for all projects, if you can support Python 2.6 and newer
|
||||
**only**, your life will be much easier. Various future statements, stdlib
|
||||
additions, etc. exist only in Python 2.6 and later which greatly assist in
|
||||
supporting Python 3. But if you project must keep support for `Python 2.5`_ then
|
||||
supporting Python 3. But if you project must keep support for Python 2.5 then
|
||||
it is still possible to simultaneously support Python 3.
|
||||
|
||||
Below are the benefits you gain if you only have to support Python 2.6 and
|
||||
|
@ -215,10 +215,10 @@ Discussed in more detail below, but you should use this future statement to
|
|||
prevent yourself from accidentally using implicit relative imports.
|
||||
|
||||
|
||||
Supporting `Python 2.5`_ and Newer Only
|
||||
///////////////////////////////////////
|
||||
Supporting Python 2.5 and Newer Only
|
||||
////////////////////////////////////
|
||||
|
||||
If you are supporting `Python 2.5`_ and newer there are still some features of
|
||||
If you are supporting Python 2.5 and newer there are still some features of
|
||||
Python that you can utilize.
|
||||
|
||||
|
||||
|
@ -230,11 +230,11 @@ Implicit relative imports (e.g., importing ``spam.bacon`` from within
|
|||
This future statement moves away from that and allows the use of explicit
|
||||
relative imports (e.g., ``from . import bacon``).
|
||||
|
||||
In `Python 2.5`_ you must use
|
||||
In Python 2.5 you must use
|
||||
the __future__ statement to get to use explicit relative imports and prevent
|
||||
implicit ones. In `Python 2.6`_ explicit relative imports are available without
|
||||
implicit ones. In Python 2.6 explicit relative imports are available without
|
||||
the statement, but you still want the __future__ statement to prevent implicit
|
||||
relative imports. In `Python 2.7`_ the __future__ statement is not needed. In
|
||||
relative imports. In Python 2.7 the __future__ statement is not needed. In
|
||||
other words, unless you are only supporting Python 2.7 or a version earlier
|
||||
than Python 2.5, use this __future__ statement.
|
||||
|
||||
|
@ -261,7 +261,7 @@ In Python 2.5 and earlier the syntax to access the current exception is::
|
|||
# Current exception is 'exc'.
|
||||
pass
|
||||
|
||||
This syntax changed in Python 3 (and backported to `Python 2.6`_ and later)
|
||||
This syntax changed in Python 3 (and backported to Python 2.6 and later)
|
||||
to::
|
||||
|
||||
try:
|
||||
|
@ -347,7 +347,7 @@ possibilities:
|
|||
Subclass ``object``
|
||||
'''''''''''''''''''
|
||||
|
||||
New-style classes have been around since `Python 2.2`_. You need to make sure
|
||||
New-style classes have been around since Python 2.2. You need to make sure
|
||||
you are subclassing from ``object`` to avoid odd edge cases involving method
|
||||
resolution order, etc. This continues to be totally valid in Python 3 (although
|
||||
unneeded as all classes implicitly inherit from ``object``).
|
||||
|
@ -610,12 +610,6 @@ please email the python-porting_ mailing list.
|
|||
.. _modernize: https://github.com/mitsuhiko/python-modernize
|
||||
.. _Porting to Python 3: http://python3porting.com/
|
||||
.. _PyPI: https://pypi.python.org/
|
||||
.. _Python 2.2: https://www.python.org/2.2.x
|
||||
.. _Python 2.5: https://www.python.org/2.5.x
|
||||
.. _Python 2.6: https://www.python.org/2.6.x
|
||||
.. _Python 2.7: https://www.python.org/2.7.x
|
||||
.. _Python 2.5: https://www.python.org/2.5.x
|
||||
.. _Python 3.3: https://www.python.org/3.3.x
|
||||
.. _Python 3 Packages: https://pypi.python.org/pypi?:action=browse&c=533&show=all
|
||||
.. _Python 3 Q & A: http://ncoghlan-devs-python-notes.readthedocs.org/en/latest/python3/questions_and_answers.html
|
||||
.. _python-porting: https://mail.python.org/mailman/listinfo/python-porting
|
||||
|
|
|
@ -493,10 +493,11 @@ The documentation for the :mod:`unicodedata` module.
|
|||
|
||||
The documentation for the :mod:`codecs` module.
|
||||
|
||||
Marc-André Lemburg gave `a presentation titled "Python and Unicode" (PDF slides) <http://downloads.egenix.com/python/Unicode-EPC2002-Talk.pdf>`_ at
|
||||
EuroPython 2002. The slides are an excellent overview of the design
|
||||
of Python 2's Unicode features (where the Unicode string type is
|
||||
called ``unicode`` and literals start with ``u``).
|
||||
Marc-André Lemburg gave `a presentation titled "Python and Unicode" (PDF slides)
|
||||
<https://downloads.egenix.com/python/Unicode-EPC2002-Talk.pdf>`_ at
|
||||
EuroPython 2002. The slides are an excellent overview of the design of Python
|
||||
2's Unicode features (where the Unicode string type is called ``unicode`` and
|
||||
literals start with ``u``).
|
||||
|
||||
|
||||
Reading and Writing Unicode Data
|
||||
|
@ -696,13 +697,20 @@ encoding the data and writing it back out.
|
|||
References
|
||||
----------
|
||||
|
||||
One section of `Mastering Python 3 Input/Output <http://pyvideo.org/video/289/pycon-2010--mastering-python-3-i-o>`_, a PyCon 2010 talk by David Beazley, discusses text processing and binary data handling.
|
||||
One section of `Mastering Python 3 Input/Output
|
||||
<http://pyvideo.org/video/289/pycon-2010--mastering-python-3-i-o>`_,
|
||||
a PyCon 2010 talk by David Beazley, discusses text processing and binary data handling.
|
||||
|
||||
The `PDF slides for Marc-André Lemburg's presentation "Writing Unicode-aware Applications in Python" <http://downloads.egenix.com/python/LSM2005-Developing-Unicode-aware-applications-in-Python.pdf>`_
|
||||
The `PDF slides for Marc-André Lemburg's presentation "Writing Unicode-aware
|
||||
Applications in Python"
|
||||
<https://downloads.egenix.com/python/LSM2005-Developing-Unicode-aware-applications-in-Python.pdf>`_
|
||||
discuss questions of character encodings as well as how to internationalize
|
||||
and localize an application. These slides cover Python 2.x only.
|
||||
|
||||
`The Guts of Unicode in Python <http://pyvideo.org/video/1768/the-guts-of-unicode-in-python>`_ is a PyCon 2013 talk by Benjamin Peterson that discusses the internal Unicode representation in Python 3.3.
|
||||
`The Guts of Unicode in Python
|
||||
<http://pyvideo.org/video/1768/the-guts-of-unicode-in-python>`_
|
||||
is a PyCon 2013 talk by Benjamin Peterson that discusses the internal Unicode
|
||||
representation in Python 3.3.
|
||||
|
||||
|
||||
Acknowledgements
|
||||
|
|
|
@ -573,9 +573,7 @@ Footnotes
|
|||
This document was reviewed and revised by John Lee.
|
||||
|
||||
.. [#] Like Google for example. The *proper* way to use google from a program
|
||||
is to use `PyGoogle <http://pygoogle.sourceforge.net>`_ of course. See
|
||||
`Voidspace Google <http://www.voidspace.org.uk/python/recipebook.shtml#google>`_
|
||||
for some examples of using the Google API.
|
||||
is to use `PyGoogle <http://pygoogle.sourceforge.net>`_ of course.
|
||||
.. [#] Browser sniffing is a very bad practise for website design - building
|
||||
sites using web standards is much more sensible. Unfortunately a lot of
|
||||
sites still send different versions to different browsers.
|
||||
|
@ -589,5 +587,5 @@ This document was reviewed and revised by John Lee.
|
|||
scripts with a localhost server, I have to prevent urllib from using
|
||||
the proxy.
|
||||
.. [#] urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe
|
||||
<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/456195>`_.
|
||||
<http://code.activestate.com/recipes/456195/>`_.
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ server may not be needed.
|
|||
tutorial also describes the most common gotchas that might arise.
|
||||
|
||||
* On lighttpd you need to use the `CGI module
|
||||
<http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModCGI>`_\ , which can be configured
|
||||
<http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModCGI>`_\ , which can be configured
|
||||
in a straightforward way. It boils down to setting ``cgi.assign`` properly.
|
||||
|
||||
|
||||
|
@ -210,7 +210,7 @@ mod_python
|
|||
----------
|
||||
|
||||
People coming from PHP often find it hard to grasp how to use Python in the web.
|
||||
Their first thought is mostly `mod_python <http://www.modpython.org/>`_\ ,
|
||||
Their first thought is mostly `mod_python <http://modpython.org/>`_\ ,
|
||||
because they think that this is the equivalent to ``mod_php``. Actually, there
|
||||
are many differences. What ``mod_python`` does is embed the interpreter into
|
||||
the Apache process, thus speeding up requests by not having to start a Python
|
||||
|
@ -260,13 +260,6 @@ the latter.
|
|||
These days, FastCGI is never used directly. Just like ``mod_python``, it is only
|
||||
used for the deployment of WSGI applications.
|
||||
|
||||
.. seealso::
|
||||
|
||||
* `FastCGI, SCGI, and Apache: Background and Future
|
||||
<http://www.vmunix.com/mark/blog/archives/2006/01/02/fastcgi-scgi-and-apache-background-and-future/>`_
|
||||
is a discussion on why the concept of FastCGI and SCGI is better than that
|
||||
of mod_python.
|
||||
|
||||
|
||||
Setting up FastCGI
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
@ -280,8 +273,8 @@ Each web server requires a specific module.
|
|||
to be loaded by Apache.
|
||||
|
||||
* lighttpd ships its own `FastCGI module
|
||||
<http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI>`_ as well as an
|
||||
`SCGI module <http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModSCGI>`_.
|
||||
<http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModFastCGI>`_ as well as an
|
||||
`SCGI module <http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModSCGI>`_.
|
||||
|
||||
* `nginx <http://nginx.org/>`_ also supports `FastCGI
|
||||
<http://wiki.nginx.org/NginxSimplePythonFCGI>`_.
|
||||
|
@ -315,7 +308,7 @@ FastCGI access.
|
|||
.. seealso::
|
||||
|
||||
There is some documentation on `setting up Django with FastCGI
|
||||
<http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/>`_, most of
|
||||
<https://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/>`_, most of
|
||||
which can be reused for other WSGI-compliant frameworks and libraries.
|
||||
Only the ``manage.py`` part has to be changed, the example used here can be
|
||||
used instead. Django does more or less the exact same thing.
|
||||
|
@ -644,7 +637,7 @@ here. Instead we will briefly touch on some of the most popular.
|
|||
Django
|
||||
^^^^^^
|
||||
|
||||
`Django <http://www.djangoproject.com/>`_ is a framework consisting of several
|
||||
`Django <https://www.djangoproject.com/>`_ is a framework consisting of several
|
||||
tightly coupled elements which were written from scratch and work together very
|
||||
well. It includes an ORM which is quite powerful while being simple to use,
|
||||
and has a great online administration interface which makes it possible to edit
|
||||
|
@ -657,7 +650,7 @@ which make it possible to create web sites almost without writing any Python cod
|
|||
It has a big, international community, the members of which have created many
|
||||
web sites. There are also a lot of add-on projects which extend Django's normal
|
||||
functionality. This is partly due to Django's well written `online
|
||||
documentation <http://docs.djangoproject.com/>`_ and the `Django book
|
||||
documentation <https://docs.djangoproject.com/>`_ and the `Django book
|
||||
<http://www.djangobook.com/>`_.
|
||||
|
||||
|
||||
|
@ -665,7 +658,7 @@ documentation <http://docs.djangoproject.com/>`_ and the `Django book
|
|||
|
||||
Although Django is an MVC-style framework, it names the elements
|
||||
differently, which is described in the `Django FAQ
|
||||
<http://docs.djangoproject.com/en/dev/faq/general/#django-appears-to-be-a-mvc-framework-but-you-call-the-controller-the-view-and-the-view-the-template-how-come-you-don-t-use-the-standard-names>`_.
|
||||
<https://docs.djangoproject.com/en/dev/faq/general/#django-appears-to-be-a-mvc-framework-but-you-call-the-controller-the-view-and-the-view-the-template-how-come-you-don-t-use-the-standard-names>`_.
|
||||
|
||||
|
||||
TurboGears
|
||||
|
@ -708,7 +701,7 @@ access to these components to the wider Python community. There is even a
|
|||
separate framework based on the Zope components: `Grok
|
||||
<http://grok.zope.org/>`_.
|
||||
|
||||
Zope is also the infrastructure used by the `Plone <http://plone.org/>`_ content
|
||||
Zope is also the infrastructure used by the `Plone <https://plone.org/>`_ content
|
||||
management system, one of the most powerful and popular content management
|
||||
systems available.
|
||||
|
||||
|
|
Loading…
Reference in New Issue