-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of original released 1.0 codebase.
- Loading branch information
0 parents
commit 14229a7
Showing
5 changed files
with
421 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2008 Jacob Kaplan-Moss | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of Django nor the names of its contributors may be used | ||
to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# file GENERATED by distutils, do NOT edit | ||
README.txt | ||
setup.py | ||
uri.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
About | ||
===== | ||
|
||
A library for simple URI handling. It has no external dependancies, and works | ||
with Python 2.3+. | ||
|
||
Currently contains only an implementation of URI-Templates | ||
(http://bitworking.org/projects/URI-Templates/) -- but see the TODO_ below. | ||
|
||
Some bits are inspired by or based on: | ||
|
||
* Joe Gregorio's example implementation | ||
(http://code.google.com/p/uri-templates/) | ||
|
||
* Addressable (http://addressable.rubyforge.org/) | ||
|
||
Examples | ||
======== | ||
|
||
Simple usage:: | ||
|
||
>>> import uri | ||
|
||
>>> args = {'foo': 'it worked'} | ||
>>> uri.expand_template("http://example.com/{foo}", args) | ||
'http://example.com/it%20worked' | ||
|
||
>>> args = {'a':'foo', 'b':'bar', 'a_b':'baz'} | ||
>>> uri.expand_template("http://example.org/{a}{b}/{a_b}", args) | ||
'http://example.org/foobar/baz' | ||
|
||
You can also use keyword arguments for a more pythonic style:: | ||
|
||
>>> uri.expand_template("http://example.org/?q={a}", a="foo") | ||
'http://example.org/?q=foo' | ||
|
||
Contributing | ||
============ | ||
|
||
I use Mercurial; the canonical repository lives at | ||
http://toys.jacobian.org/hg/uri. Please feel free to send patches or links to | ||
other branches to <[email protected]> | ||
|
||
TODO | ||
---- | ||
|
||
Over time, I'd like to add the following features to this library: | ||
|
||
* ``uri.extract(template, uri)``: extract a dict of info given a template | ||
and a URI. | ||
|
||
* ``uri.parse(uri)``: thin wrapper around ``urlparse.urlparse()`` that | ||
returns a class (so you can do e.g. ``some_uri.fragment`` or whathaveyou.) | ||
This URI class should have expand/extract methods. | ||
|
||
* Add methods/functions to do sane URI joining -- ``urlparse.urljoin`` | ||
*never* does what I think it's going to do, especially when faced | ||
with relative URIs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import warnings | ||
|
||
try: | ||
from setuptools.core import setup | ||
except ImportError: | ||
try: | ||
from setuptools import setup | ||
except ImportError: | ||
from distutils.core import setup | ||
|
||
warnings.warn("""The 'uri' package will be changing drastically in the near future. | ||
As a result you will need to pin the version to 'uri<2.0' to avoid issues.""", | ||
FutureWarning) | ||
|
||
setup( | ||
name = "uri", | ||
version = "1.0.1", | ||
description = "A library for URI handling featuring an implementation of URI-Templates", | ||
author = 'Jacob Kaplan-Moss', | ||
author_email = '[email protected]', | ||
maintainer = 'Alice Bevan-McGregor', | ||
maintainer_email = '[email protected]', | ||
py_modules = ['uri'], | ||
classifiers = [ | ||
'Development Status :: 1 - Planning', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: BSD License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Topic :: Internet', | ||
] | ||
) |
Oops, something went wrong.