Mercurial > p > roundup > code
comparison roundup/cgi/actions.py @ 2362:10fc45eea226
fix SearchAction use of Class.filter(), and clarify API docs for same
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 23 May 2004 23:24:47 +0000 |
| parents | 90cca653ef3d |
| children | c26bb78d2f0c |
comparison
equal
deleted
inserted
replaced
| 2361:9cdc49488fe6 | 2362:10fc45eea226 |
|---|---|
| 1 #$Id: actions.py,v 1.28 2004-05-13 00:19:35 richard Exp $ | 1 #$Id: actions.py,v 1.29 2004-05-23 23:24:47 richard Exp $ |
| 2 | 2 |
| 3 import re, cgi, StringIO, urllib, Cookie, time, random | 3 import re, cgi, StringIO, urllib, Cookie, time, random |
| 4 | 4 |
| 5 from roundup import hyperdb, token, date, password, rcsv, exceptions | 5 from roundup import hyperdb, token, date, password, rcsv, exceptions |
| 6 from roundup.i18n import _ | 6 from roundup.i18n import _ |
| 146 klass=self.classname, url=url) | 146 klass=self.classname, url=url) |
| 147 else: | 147 else: |
| 148 # edit the new way, query name not a key any more | 148 # edit the new way, query name not a key any more |
| 149 # see if we match an existing private query | 149 # see if we match an existing private query |
| 150 uid = self.db.getuid() | 150 uid = self.db.getuid() |
| 151 qids = self.db.query.filter({}, {'name': queryname, | 151 qids = self.db.query.filter(None, {'name': queryname, |
| 152 'private_for': uid}) | 152 'private_for': uid}) |
| 153 if not qids: | 153 if not qids: |
| 154 # ok, so there's not a private query for the current user | 154 # ok, so there's not a private query for the current user |
| 155 # - see if there's a public one created by them | 155 # - see if there's a public one created by them |
| 156 qids = self.db.query.filter({}, {'name': queryname, | 156 qids = self.db.query.filter(None, {'name': queryname, |
| 157 'private_for': -1, 'creator': uid}) | 157 'private_for': -1, 'creator': uid}) |
| 158 | 158 |
| 159 if qids: | 159 if qids: |
| 160 # edit query | 160 # edit query - make sure we get an exact match on the name |
| 161 qid = qids[0] | 161 for qid in qids: |
| 162 self.db.query.set(qid, klass=self.classname, url=url) | 162 if queryname != self.db.query.get(qid, 'name'): |
| 163 continue | |
| 164 self.db.query.set(qid, klass=self.classname, url=url) | |
| 163 else: | 165 else: |
| 164 # create a query | 166 # create a query |
| 165 qid = self.db.query.create(name=queryname, | 167 qid = self.db.query.create(name=queryname, |
| 166 klass=self.classname, url=url, private_for=uid) | 168 klass=self.classname, url=url, private_for=uid) |
| 167 | 169 |
