Commit 0ffb4626 authored by Georg Brandl's avatar Georg Brandl

Fixing broken links in doc, part 2: howto/

parent fa55a317
...@@ -133,7 +133,7 @@ Note, in Python 2.2, ``super(B, obj).m()`` would only invoke :meth:`__get__` if ...@@ -133,7 +133,7 @@ Note, in Python 2.2, ``super(B, obj).m()`` would only invoke :meth:`__get__` if
invoked unless an old-style class is involved. The implementation details are invoked unless an old-style class is involved. The implementation details are
in :c:func:`super_getattro()` in :source:`Objects/typeobject.c`. in :c:func:`super_getattro()` in :source:`Objects/typeobject.c`.
.. _`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 The details above show that the mechanism for descriptors is embedded in the
:meth:`__getattribute__()` methods for :class:`object`, :class:`type`, and :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 ...@@ -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 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. 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 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. 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 of Python which you believe can be your minimum support version
and work from there. and work from there.
...@@ -144,19 +144,19 @@ for you. ...@@ -144,19 +144,19 @@ for you.
Support Python 2.7 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 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 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 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). 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 **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 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. 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 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 ...@@ -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. 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. Python that you can utilize.
...@@ -230,11 +230,11 @@ Implicit relative imports (e.g., importing ``spam.bacon`` from within ...@@ -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 This future statement moves away from that and allows the use of explicit
relative imports (e.g., ``from . import bacon``). 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 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 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 other words, unless you are only supporting Python 2.7 or a version earlier
than Python 2.5, use this __future__ statement. 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:: ...@@ -261,7 +261,7 @@ In Python 2.5 and earlier the syntax to access the current exception is::
# Current exception is 'exc'. # Current exception is 'exc'.
pass 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:: to::
try: try:
...@@ -347,7 +347,7 @@ possibilities: ...@@ -347,7 +347,7 @@ possibilities:
Subclass ``object`` 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 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 resolution order, etc. This continues to be totally valid in Python 3 (although
unneeded as all classes implicitly inherit from ``object``). unneeded as all classes implicitly inherit from ``object``).
...@@ -610,12 +610,6 @@ please email the python-porting_ mailing list. ...@@ -610,12 +610,6 @@ please email the python-porting_ mailing list.
.. _modernize: https://github.com/mitsuhiko/python-modernize .. _modernize: https://github.com/mitsuhiko/python-modernize
.. _Porting to Python 3: http://python3porting.com/ .. _Porting to Python 3: http://python3porting.com/
.. _PyPI: https://pypi.python.org/ .. _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 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 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 .. _python-porting: https://mail.python.org/mailman/listinfo/python-porting
......
...@@ -500,7 +500,7 @@ The documentation for the :mod:`codecs` module. ...@@ -500,7 +500,7 @@ The documentation for the :mod:`codecs` module.
Marc-André Lemburg gave a presentation at EuroPython 2002 titled "Python and Marc-André Lemburg gave a presentation at EuroPython 2002 titled "Python and
Unicode". A PDF version of his slides is available at Unicode". A PDF version of his slides is available at
<http://downloads.egenix.com/python/Unicode-EPC2002-Talk.pdf>, and is an <https://downloads.egenix.com/python/Unicode-EPC2002-Talk.pdf>, and is an
excellent overview of the design of Python's Unicode features. excellent overview of the design of Python's Unicode features.
...@@ -687,7 +687,7 @@ References ...@@ -687,7 +687,7 @@ References
The PDF slides for Marc-André Lemburg's presentation "Writing Unicode-aware The PDF slides for Marc-André Lemburg's presentation "Writing Unicode-aware
Applications in Python" are available at Applications in Python" are available at
<http://downloads.egenix.com/python/LSM2005-Developing-Unicode-aware-applications-in-Python.pdf> <https://downloads.egenix.com/python/LSM2005-Developing-Unicode-aware-applications-in-Python.pdf>
and discuss questions of character encodings as well as how to internationalize and discuss questions of character encodings as well as how to internationalize
and localize an application. and localize an application.
......
...@@ -560,9 +560,7 @@ This document was reviewed and revised by John Lee. ...@@ -560,9 +560,7 @@ This document was reviewed and revised by John Lee.
.. [#] For an introduction to the CGI protocol see .. [#] For an introduction to the CGI protocol see
`Writing Web Applications in Python <http://www.pyzine.com/Issue008/Section_Articles/article_CGIOne.html>`_. `Writing Web Applications in Python <http://www.pyzine.com/Issue008/Section_Articles/article_CGIOne.html>`_.
.. [#] Like Google for example. The *proper* way to use google from a program .. [#] Like Google for example. The *proper* way to use google from a program
is to use `PyGoogle <http://pygoogle.sourceforge.net>`_ of course. See is to use `PyGoogle <http://pygoogle.sourceforge.net>`_ of course.
`Voidspace Google <http://www.voidspace.org.uk/python/recipebook.shtml#google>`_
for some examples of using the Google API.
.. [#] Browser sniffing is a very bad practise for website design - building .. [#] Browser sniffing is a very bad practise for website design - building
sites using web standards is much more sensible. Unfortunately a lot of sites using web standards is much more sensible. Unfortunately a lot of
sites still send different versions to different browsers. sites still send different versions to different browsers.
...@@ -576,5 +574,5 @@ This document was reviewed and revised by John Lee. ...@@ -576,5 +574,5 @@ This document was reviewed and revised by John Lee.
scripts with a localhost server, I have to prevent urllib2 from using scripts with a localhost server, I have to prevent urllib2 from using
the proxy. the proxy.
.. [#] urllib2 opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe .. [#] urllib2 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. ...@@ -146,7 +146,7 @@ server may not be needed.
tutorial also describes the most common gotchas that might arise. tutorial also describes the most common gotchas that might arise.
* On lighttpd you need to use the `CGI module * 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. in a straightforward way. It boils down to setting ``cgi.assign`` properly.
...@@ -210,7 +210,7 @@ mod_python ...@@ -210,7 +210,7 @@ mod_python
---------- ----------
People coming from PHP often find it hard to grasp how to use Python in the web. 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 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 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 the Apache process, thus speeding up requests by not having to start a Python
...@@ -260,13 +260,6 @@ the latter. ...@@ -260,13 +260,6 @@ the latter.
These days, FastCGI is never used directly. Just like ``mod_python``, it is only These days, FastCGI is never used directly. Just like ``mod_python``, it is only
used for the deployment of WSGI applications. 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 Setting up FastCGI
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
...@@ -280,8 +273,8 @@ Each web server requires a specific module. ...@@ -280,8 +273,8 @@ Each web server requires a specific module.
to be loaded by Apache. to be loaded by Apache.
* lighttpd ships its own `FastCGI module * lighttpd ships its own `FastCGI module
<http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI>`_ as well as an <http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModFastCGI>`_ as well as an
`SCGI module <http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModSCGI>`_. `SCGI module <http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModSCGI>`_.
* `nginx <http://nginx.org/>`_ also supports `FastCGI * `nginx <http://nginx.org/>`_ also supports `FastCGI
<http://wiki.nginx.org/NginxSimplePythonFCGI>`_. <http://wiki.nginx.org/NginxSimplePythonFCGI>`_.
...@@ -314,7 +307,7 @@ FastCGI access. ...@@ -314,7 +307,7 @@ FastCGI access.
.. seealso:: .. seealso::
There is some documentation on `setting up Django with FastCGI 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. 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 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. used instead. Django does more or less the exact same thing.
...@@ -648,7 +641,7 @@ here. Instead we will briefly touch on some of the most popular. ...@@ -648,7 +641,7 @@ here. Instead we will briefly touch on some of the most popular.
Django 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 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, 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 and has a great online administration interface which makes it possible to edit
...@@ -661,7 +654,7 @@ which make it possible to create web sites almost without writing any Python cod ...@@ -661,7 +654,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 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 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 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/>`_. <http://www.djangobook.com/>`_.
...@@ -669,7 +662,7 @@ documentation <http://docs.djangoproject.com/>`_ and the `Django book ...@@ -669,7 +662,7 @@ documentation <http://docs.djangoproject.com/>`_ and the `Django book
Although Django is an MVC-style framework, it names the elements Although Django is an MVC-style framework, it names the elements
differently, which is described in the `Django FAQ 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 TurboGears
...@@ -712,7 +705,7 @@ access to these components to the wider Python community. There is even a ...@@ -712,7 +705,7 @@ access to these components to the wider Python community. There is even a
separate framework based on the Zope components: `Grok separate framework based on the Zope components: `Grok
<http://grok.zope.org/>`_. <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 management system, one of the most powerful and popular content management
systems available. systems available.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment