diff options
author | bbangert <none@none> | 2006-01-13 13:38:50 -0800 |
---|---|---|
committer | bbangert <none@none> | 2006-01-13 13:38:50 -0800 |
commit | 888c3f38c0f31cf9c89a9da6f390962dfdea69a3 (patch) | |
tree | 876f14494879b7df202c16ca4ce05777d952b447 | |
parent | 2ec0b56960ac5f4788c20d7f9b03c6d378aa327d (diff) | |
download | routes-888c3f38c0f31cf9c89a9da6f390962dfdea69a3.tar.gz |
[svn] Manual updates, front page has news
--HG--
branch : trunk
-rw-r--r-- | docs/index.txt | 11 | ||||
-rw-r--r-- | docs/manual.txt | 51 |
2 files changed, 56 insertions, 6 deletions
diff --git a/docs/index.txt b/docs/index.txt index 3ece050..8dc6bfe 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -11,10 +11,21 @@ Current features: * Named Routes * Sophisticated Route lookup and URL generation * Wildcard path's before and after static parts +* Groupings syntax to allow flexible URL's to accommodate almost any need * Extensive unit tests Buzzword Compliance: *REST*, *DRY* +News +==== + +*January 13th, 2006* + +Routes 1.1 released with: + +* Easier integration +* Powerful Groupings syntax for more flexibility + Documentation ============= diff --git a/docs/manual.txt b/docs/manual.txt index 5ba2465..0c538d9 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -93,17 +93,21 @@ _`Dynamic Part` A dynamic part matches text in that part of the URL, and assigns what it finds to the name after the ``:`` mark. -_`Dynamic Grouping` - ``m.connect('article', 'article/:section/:slug/`` :(page) ``.html', ...`` - - A dynamic grouping matches text like a Dynamic Part, however it's boundaries are defined - by the () characters so that it can be used next to static parts. - _`Wildcard Part` ``m.connect('file/`` \*url ``', controller='file', action='serve')`` A wildcard part will match *everything* except the other parts around it. +_`Groupings` + ``m.connect('article', 'article/:section/:slug/`` :(page) ``.html', ...`` + + ``m.connect('file/`` \*(url) ``.html', controller='file', action='serve')`` + + Groupings let you define boundries for the match with the () characters. This allows you to + match wildcards and dynamics next to other static and dynamic parts. Care should be taken + when using Groupings next to each other. + + Defaults ======== @@ -168,6 +172,41 @@ If a `dynamic part`_ with a default is followed by either `static part`_'s or `d This way, the URL coming in maps up to the `route path`_ you created, part for part. +When using `Groupings`_, parts will still be left off, but only if the remainder of the URL has no +static after it. This can lead to some odd looking URL's being generated if you aren't careful about +your requirements and defaults. For example:: + + # Groupings without requirements + m.connect(':controller/:(action)-:(id)') + + # Matches: + # /archives/view-3 + # /archives/view- + + # Generation: + url_for(controller='archives', action='view') + # /archives/view- + +It's unlikely you want such a URL, and would prefer to ensure that there's always an id supplied. To +enforce this behavior we will use `Requirements`_:: + + # Groupings without requirements + m.connect(':controller/:(action)-:(id)', requirements=dict(id='\d+')) + + # Matches: + # /archives/view-3 + # /archives/view-2 + + # Does Not Match: + # /archives/view- + + # Generation: + url_for(controller='archives', action='view', id=2) + # /archives/view-2 + +If you end up with URL's missing parts you'd like left on when using `Groupings`_, add a requirement +to that part. + Implicit Defaults ================= |