summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bangert <ben@groovie.org>2012-03-13 11:41:14 -0700
committerBen Bangert <ben@groovie.org>2012-03-13 11:41:14 -0700
commit75297bc6267698f18bb19e821f52fe67ae51820b (patch)
treec273d9b8826bbb2d1a18db82fbf8110defe727a2
parentcd3c64694656860014743fbac6cbfda455ad879d (diff)
downloadroutes-75297bc6267698f18bb19e821f52fe67ae51820b.tar.gz
Update docs
--HG-- branch : trunk
-rw-r--r--docs/index.rst27
-rw-r--r--docs/introduction.rst12
-rw-r--r--docs/setting_up.rst21
3 files changed, 39 insertions, 21 deletions
diff --git a/docs/index.rst b/docs/index.rst
index 3632d65..ba8025d 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,10 +1,37 @@
+====================
Routes Documentation
====================
+.. image:: routes-logo.png
+ :width: 100px
+ :height: 171px
+ :align: left
+
Routes is a Python re-implementation of the Rails routes system for mapping URLs to application actions, and conversely to generate URLs. Routes makes it easy to create pretty and concise URLs that are RESTful with little effort.
Routes allows conditional matching based on domain, cookies, HTTP method, or a custom function. Sub-domain support is built in. Routes comes with an extensive unit test suite.
+Installing
+==========
+
+Routes can be easily installed with pip or easy_install::
+
+ $ easy_install routes
+
+Example
+=======
+
+.. code-block:: python
+
+ # Setup a mapper
+ from routes import Mapper
+ map = Mapper()
+ map.connect(None, "/error/{action}/{id}, controller="error")
+ map.connect("home", "/", controller="main", action="index")
+
+ # Match a URL, returns a dict or None if no match
+ result = map.match('/error/myapp/4')
+ # result == {'controller': 'main', 'action': 'myapp', 'id': '4'}
.. toctree::
:maxdepth: 2
diff --git a/docs/introduction.rst b/docs/introduction.rst
index 8555c35..a954b2b 100644
--- a/docs/introduction.rst
+++ b/docs/introduction.rst
@@ -1,11 +1,6 @@
Introduction
============
-.. image:: routes-logo.png
- :width: 100px
- :height: 171px
- :align: left
-
Routes tackles an interesting problem that comes up frequently in web
development, *how do you map URLs to your application's actions*? That is, how
do you say that *this* should be accessed as "/blog/2008/01/08", and "/login"
@@ -49,10 +44,3 @@ recommend reading the `Glossary <glossary.html>`_ before continuing.
This manual is written from the user's perspective: how to use Routes in a
framework that already supports it. The `Porting <porting.html>`_
manual describes how to add Routes support to a new framework.
-
-You may have heard about a development version called "Routes 2". Routes 2 is
-now called "Routes-experimental". It was originally intended to be a
-refactoring with a new API. Instead its features are being incorporated into
-Routes 1 in a compatible manner. There may be another Routes 2 in the future
-that drops deprecated features, but it's too early to say when/if that might
-happen.
diff --git a/docs/setting_up.rst b/docs/setting_up.rst
index 594e60a..0daf459 100644
--- a/docs/setting_up.rst
+++ b/docs/setting_up.rst
@@ -3,15 +3,18 @@ Setting up routes
It is assumed that you are using a framework that has preconfigured Routes for
you. In Pylons, you define your routes in the ``make_map`` function in your
-*myapp/config/routing.py* module. Here is a typical configuration::
-
- 1 from routes import Mapper
- 2 map = Mapper()
- 3 map.connect(None, "/error/{action}/{id}, controller="error")
- 4 map.connect("home", "/", controller="main", action="index")
- 5 # ADD CUSTOM ROUTES HERE
- 6 map.connect(None, "/{controller}/{action}")
- 7 map.connect(None, "/{controller}/{action}/{id}")
+*myapp/config/routing.py* module. Here is a typical configuration:
+
+.. code-block:: python
+ :number-lines: 1
+
+ from routes import Mapper
+ map = Mapper()
+ map.connect(None, "/error/{action}/{id}, controller="error")
+ map.connect("home", "/", controller="main", action="index")
+ # ADD CUSTOM ROUTES HERE
+ map.connect(None, "/{controller}/{action}")
+ map.connect(None, "/{controller}/{action}/{id}")
Lines 1 and 2 create a mapper.