summaryrefslogtreecommitdiff
path: root/routes
Commit message (Collapse)AuthorAgeFilesLines
* Remove end comma in arg list.Robin Abbi2020-05-041-1/+1
| | | | Failed py34 syntax validation.
* Add conditions to Mapper.extend.Robin Abbi2020-05-041-1/+5
|
* Fix a little syntax errorchengkunye2016-07-222-3/+2
|
* Fix missing quotes in documentationSean Dague2016-06-201-1/+1
| | | | | When reading the docs I discovered a missing set of single quotes in this code example which makes the example invalid python code. Fixed.
* Tolerate older usage with mandatory routename and optional pathDavanum Srinivas2016-03-291-10/+10
| | | | | | | | | | | | | | | | | With the following review: https://github.com/bbangert/routes/commit/0a417004be7e2d950bdcd629ccf24cf9f56ef817 Routes 2.3 has changed the function signature to mandate path in addition to routename for the connect method. In this patch, we try to get back to path being optional by checking the length of the args list. No other change in logic. This hopefully fixes the problem reported here: https://github.com/bbangert/routes/issues/64 Add an entry in Changelog as well.
* Fix subdomain equivalence check. Use regex instead of startswithNikita Uvarov2016-03-241-3/+5
| | | | | Problem occurred when new subdomain was left substring of current one. In this case subdomain was not replaced.
* Wrap conditions with parenthesesSviatoslav Sydorenko2016-02-281-2/+2
|
* Add support for protocol-relative URLs generation. Close #29Sviatoslav Sydorenko2016-02-231-12/+24
|
* Document possibility of depending on [middleware]. Fix #38Sviatoslav Sydorenko2016-02-211-1/+6
|
* Fix BytesWarning in Mapper.generate()Victor Stinner2016-02-091-1/+5
| | | | | | | | | | | | When python3 is run with -bb, str(bytes) raises a BytesWarning. On Python 3, Mapper.generate() gets such BytesWarning because script_name type is str whereas cache_key type is byte. On Python 3, generate() now encodes the script_name to UTF-8 and uses bytes concatenation to fix this issue. .travis.yml: Run tests using "python -bb $(which nosetests)" to raise BytesWarning exception on bytes vs Unicode issue.
* Fix empty string matchSviatoslav Sydorenko2016-02-011-4/+4
|
* Add support for ``requirements`` to mapper.resourceSean Dague2016-01-131-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | This adds support for ``requirements`` option to mapper.resource, which makes it possible to restrict matching in urls (most often useful for capturing variables with path_prefix). In OpenStack Nova we've used the prefix_path on Mapper.resource to specify additional variables we want to capture (specifically {project_id}). Project_id is a uuid. When trying to restrict project_id to only valid uuid format a couple of issues were exposed. - #1 '/{project_id:[a-f0-9]{32}}/...' builds an incorrect regex because of the nested {} - #2 the preferred method that works on connect() to pass requirements doesn't work here (requirements are reset to only an id match) That leaves us with having to build a custom project_id match with 32 [a-f0-9] strings appended for every resource added to get the support we need without effectively vendoring our own version of Mapper.resource. This small change to allow requirements to pass through would make it possible to get this tighter validation with much smaller regexes.
* Modify submapping behavior to avoid concatenationmikepk2015-08-181-11/+37
| | | | | | | | | | | | | | | | | | | | | | Allow name_prefixes to concatenate in submapper nesting. Also fix the case where the concatenation behavior was being applied to all non-dictionary arguments in the submapper. This had the effect of concat'ing args like controller definition together rather than allowing submapper definitions to override parent definitions for arguments. Fix mapper so that collection_name can be None. For collections with no collection_name, adds a logic branch to handle the case cleanly and provide a reasonable path_prefix. Remove special controller case This change makes routes treat path_prefix and name_prefix as special instead of 'controller' as special. This allows any argument to be overridden in child submappers and allows the 'prefix' args to concatenate as you would expect. Add extended call signature to add_action, missing from previous commits
* Port routes to Python 3Victor Stinner2015-06-183-56/+62
| | | | | | | | | | | | | | | | | | | The code now works on Python 2 and Python 3 without modifications: 2to3 is no more needed. Changes: * Drop 2to3 from setup.py: the code is now directly compatible with Python 2 and Python 3 * Add dependency to six * Drop support for Python 3.2: remove 3.2 from .travis.yml * Replace "for key, value in dict.iteritems():" with "for key, value in six.iteritems(dict):" * Use six.moves.urllib to get urllib functions * Replace unicode() with six.text_type() * Replace dict.keys() with list(dict.keys()) * Replace "dict.has_key(key)" with "key in dict" * Remove "py3where=build" from notests section of setup.cfg * Add parenthesis to print() * Replace dict.items() with list(dict.items())
* * Fix 3 other route matching groups in route.py to use anonymous groups forBen Bangert2015-01-171-3/+3
| | | | optional sections to avoid exceeding regex limits. Fixes #15.
* * Printing a mapper now includes the Controller/action parameters from theBen Bangert2015-01-171-2/+3
| | | | route. Fixes #11.
* * Fix regression that didn't allow passing in params 'host', 'protocol', orBen Bangert2015-01-171-0/+4
| | | | | 'anchor'. They can now be passed in with a trailing '_' as was possible before commit d1d1742903fa5ca24ef848a6ae895303f2661b2a. Fixes #7.
* * URL generation with/without SCRIPT_NAME was resulting in the URL cacheBen Bangert2015-01-171-13/+13
| | | | | | failing to return the appropriate cached URL generation. The URL cache should always include the SCRIPT_NAME, even if its empty, in the cache to avoid this, and now does. Fixes #6.
* Fix doctests.Ben Bangert2015-01-171-12/+5
|
* * Use the first X_FORWARDED_FOR value if there are multiple proxies in theBen Bangert2015-01-172-3/+6
| | | | path. Fixes #5.
* PEP8 cleanups.Ben Bangert2015-01-175-517/+551
|
* Extract Route creation into separate methodSam Phillips2014-01-201-1/+8
| | | | Allow a Mapper subclass to use a different Route implementation.
* Merge pull request #14 from blamarvt/overflow-fixBen Bangert2013-11-201-4/+13
|\ | | | | Allow for a large number of URL matches
| * Allow for a large number of URL matchesBrian Lamar2013-11-201-4/+13
| | | | | | | | | | | | | | | | | | | | | | Currently routes/regex raises an OverflowError when compiling a master list of 'valid' URLs if the number of controllers/routes is extremely high. This error can be worked around by assuming all URLs are good until all matches have been tested. This means that on large projects performance will be slightly increased with valid requests and slightly decreased with invalid requests.
* | Let submappers' children have their own controllers.Yuriy Taraday2013-11-181-0/+2
|/
* Merge pull request #3 from YorikSar/doc_fixBen Bangert2013-05-231-1/+1
|\ | | | | Small misprint fix in collection() docs
| * Small misprint fix in collection() docsYuriy Taraday2012-08-311-1/+1
| |
* | Fix doctests.Alejandro Sánchez2013-05-031-2/+2
| |
* | Add Python 3 support.Alejandro Sánchez2013-05-033-52/+84
|/
* mergeBen Bangert2012-03-121-2/+2
|\ | | | | | | | | --HG-- branch : trunk
| * Fixing the regex by removing an extra ?Michael Basnight2012-02-281-1/+1
| | | | | | | | | | --HG-- branch : trunk
| * Added functionality to allow escaped dots in urlsMichael Basnight2012-02-281-2/+2
| | | | | | | | | | | | | | | | | | * Added to regex to allow excaped dots in urls * Added tests to make sure escaped dots work and dont clobber the existing format strings --HG-- branch : trunk
* | Remove custom LRU and use repoze.lruBen Bangert2010-06-282-74/+7
|/ | | | | --HG-- branch : e2.0
* * Fix bug with URLGenerator not properly including SCRIPT_NAME when generatingBen Bangert2010-06-052-3/+5
| | | | | | | URL's and the singleton is not present. --HG-- branch : trunk
* * Fix bug with routes not generating URL's with callables in defaults.v1.12.1Ben Bangert2010-03-112-2/+3
| | | | | --HG-- branch : trunk
* * Fix bug with routes not handling sub-domain defaults during generation.Ben Bangert2010-03-052-2/+8
| | | | | --HG-- branch : trunk
* Major re-org of the docsBen Bangert2010-02-283-43/+4
| | | | | --HG-- branch : trunk
* * Fix bug with relative URL's using qualified merging host and URL withoutBen Bangert2010-02-281-1/+3
| | | | | | | including the appropriate slash. Fixes #13. --HG-- branch : trunk
* * Fix bug with mapper.extend and Routes modifying their original args.Ben Bangert2010-02-281-2/+3
| | | | | | | Fixes #24. --HG-- branch : trunk
* * Fix url.current() not returning current args when explicit is True.Ben Bangert2010-02-282-5/+7
| | | | | | | * Return explicit to being default to True. --HG-- branch : trunk
* Remove a ternary operation in the Mapper to get it working on Python 2.4Luke Macken2010-02-281-1/+1
| | | | | --HG-- branch : trunk
* Ensure singleton usage is still default in middleware so Routes upgrade ↵Ben Bangert2010-02-281-5/+13
| | | | | | | doesn't break url_for users. --HG-- branch : trunk
* Another module up to 100% test coverageBen Bangert2010-02-201-2/+0
| | | | | --HG-- branch : trunk
* mergeBen Bangert2010-02-202-39/+78
|\ | | | | | | | | --HG-- branch : trunk
| * Fix inline requirements in {.format:reqs}Mike Burrows2010-02-141-4/+6
| | | | | | | | | | --HG-- branch : trunk
| * Have collection() use the new {.format} component if needed instead of ↵Mike Burrows2010-02-101-22/+26
| | | | | | | | | | | | | | generating separate "formatted routes" --HG-- branch : trunk
| * {.format} path componentsMike Burrows2010-02-102-17/+50
| | | | | | | | | | --HG-- branch : trunk
* | More tests, coverageBen Bangert2010-02-202-20/+7
| | | | | | | | | | --HG-- branch : trunk
* | More test coverageBen Bangert2010-02-201-4/+0
| | | | | | | | | | --HG-- branch : trunk
* | Increase unit tests and add more explicit use of the mapper for matching.Ben Bangert2010-02-202-16/+17
| | | | | | | | | | --HG-- branch : trunk