comparison urlmatch.txt @ 0:8bd0c3b2163e

create urlmatch package
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 13 Jun 2011 21:25:06 -0700
parents
children 64935a05afdb
comparison
equal deleted inserted replaced
-1:000000000000 0:8bd0c3b2163e
1 urlmatch
2 ========
3
4 Test making a basic tree::
5
6 >>> urlmatcher = URLmatcher()
7 >>> urls = ['http://example.com/foo/bar.html',
8 ... 'http://example.com/foo/baz.html',
9 ... 'http://example.com/foo/fleem.html']
10 >>> urlmatcher.add(*urls)
11 >>> urlmatcher.tree()
12 ['http://example.com/foo/': ['bar.html', 'baz.html', 'fleem.html']]
13
14 Now a more complex tree::
15
16 >>> urlmatcher = URLmatcher()
17 >>> urlmatcher.add(*['http://example.com/index.html',
18 ... 'https://example.com/,
19 ... 'http://gitcub.com/k0s'])
20 >>> urlmatcher.tree()
21 ['example.com': ['