Mercurial > hg > TagInTheMiddle
annotate taginthemiddle/model.py @ 19:57ca873ed9bf default tip
make this a pluggable system and start reorging infrastructure for that
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 25 May 2010 07:48:53 -0700 |
parents | c85d42296c06 |
children |
rev | line source |
---|---|
1
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
1 """ |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
2 Tags models. Tags have: |
1
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
3 - a list of resources they're applied to |
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
4 - a time they're applied |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
5 - someone that tagged the resource |
1
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
6 """ |
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
7 |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
8 import os |
1
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
9 import time |
19
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
10 from pkg_resources import iter_entry_points |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
11 |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
12 ### interface |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
13 |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 class Tags(object): |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
15 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
16 abstract base class for tagging |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
17 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
18 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
19 def add(self, tag, url, author): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
20 """add a tag to a URL""" |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
21 raise NotImplementedError |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
22 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
23 def remove(self, tag, url): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
24 """remove a tag from a URL""" |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
25 raise NotImplementedError |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
26 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
27 def tags(self, url): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
28 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
29 get the tags for a URL |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
30 """ |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
31 |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
32 def urls(self, *tags): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
33 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
34 get the URLs for a set of tags |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
35 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
36 |
19
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
37 def make_tags(string): |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
38 """ |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
39 Instantiate and return a tag engine from a setuptools entry point |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
40 - string: "URL" of tagger (e.g. 'file:///path/to/file?author=whoami') |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
41 """ |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
42 |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
43 # have to split out the schema ourselves or urlparse is too smart for |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
44 # its own good |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
45 assert '://' in string # XXX could also not have this for no parameters |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
46 name, value = string.split('://', 1) |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
47 |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
48 import pdb; pdb.set_trace() |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
49 |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
50 ### implementation |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
51 |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
52 class FileTags(Tags): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
53 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
54 file (e.g. .ini) based tagging scheme |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
55 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
56 File format: |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
57 foo = /bar:1273023556 /fleem/baz:1273023556 etc |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
58 cats = /cats:1273023556 /blog/mycat:1273023556 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
59 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
60 # XXX TODO: store user; currently this is not stored |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
61 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
62 def __init__(self, path, author): |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
63 """ |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
64 - path: path to file |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
65 - author: who tagged the resource (fudge for now) |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
66 """ |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
67 self.path = path |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
68 if not os.path.exists(path): |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
69 f = file(path, 'w') |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
70 f.close() |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
71 self._tags = {} |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
72 self._urls = {} |
1
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
73 self.times = {} |
8
fc3491dfe374
correct function signature for reading tags file
Jeff Hammel <jhammel@mozilla.com>
parents:
2
diff
changeset
|
74 self.read() |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
75 |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
76 def read(self): |
8
fc3491dfe374
correct function signature for reading tags file
Jeff Hammel <jhammel@mozilla.com>
parents:
2
diff
changeset
|
77 for line in file(self.path).readlines(): |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
78 line = line.strip() |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
79 if not line: |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
80 continue |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
81 tag, urls = line.split('=', 1) # asserts '=' in line |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
82 tag = tag.strip() |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
83 urls = urls.strip() |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
84 self._tags[tag] = set([urls]) |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
85 for url in urls: |
1
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
86 url, time = url.rsplit(':', 1) |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
87 self._urls.setdefault(url, set()).add(tag) |
1
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
88 self.times[(tag, url)] = int(time) |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
89 |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
90 def write(self): |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
91 f = file(self.path, 'w') |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
92 for tag in sorted(self.tags.keys()): |
1
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
93 print >> f, '%s = %s' % (tag, ' '.join(['%s:%s' % (url, self.times(tag, url)) |
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
94 for url in self.tags[tag]])) |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
95 f.close() |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
96 |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
97 ### implementation of Tags interface |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
98 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
99 def add(self, tag, url, author): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
100 if url in self._tags[tag]: |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
101 return |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
102 self._tags[tag].add(url) |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
103 self._urls[url].add(tag) |
1
837cfc05d4d9
add times to tags; cant things ever be easy?
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
104 self.times[(tag, url)] = int(time.time()) |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
105 self.write() |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
106 |
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
107 def remove(self, tag, url): |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
108 if url not in self._tags[tag]: |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
109 return |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
110 self._tags[tag].remove(url) |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
111 self._urls[url].remove(tag) |
2
1182315b18ac
add rudimentary code for handlers
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
112 del self.times[(tag, url)] |
0
1c5cbbde4299
initial commit of middleware tagging; doesnt yet work
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
113 self.write() |
17
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
114 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
115 def tags(self, url): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
116 raise NotImplementedError |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
117 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
118 def urls(self, *tags): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
119 raise NotImplementedError |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
120 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
121 class SQLiteTags(Tags): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
122 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
123 Tags model using SQLite |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
124 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
125 Tags are relational data stored in a table |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
126 Tag | URL | Author | Date [seconds since epoch] |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
127 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
128 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
129 def __init__(self, path): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
130 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
131 - path: path to SQLite file |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
132 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
133 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
134 def add(self, tag, url, author): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
135 raise NotImplementedError |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
136 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
137 def remove(self, tag, url): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
138 raise NotImplementedError |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
139 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
140 def tags(self, url): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
141 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
142 select * from tags where url='url' |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
143 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
144 |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
145 def urls(self, *tags): |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
146 """ |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
147 select * from tags where tag='' |
c85d42296c06
make the model almost be real
Jeff Hammel <jhammel@mozilla.com>
parents:
9
diff
changeset
|
148 """ |
19
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
149 |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
150 ### command line |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
151 |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
152 if __name__ == '__main__': |
57ca873ed9bf
make this a pluggable system and start reorging infrastructure for that
Jeff Hammel <jhammel@mozilla.com>
parents:
17
diff
changeset
|
153 foo = make_tags('file:///tmp/foo.tags?author=bar') |