Mercurial > p > roundup > code
diff roundup/backends/back_tsearch2.py @ 3061:b0f5ea4e4dff
First fixes for Python 2.1 compatibility:
* don't use booleans
* don't use a string > 1 char with 'in'
* use has_key instead of 'in' for dictionaries
| author | Johannes Gijsbers <jlgijsbers@users.sourceforge.net> |
|---|---|
| date | Wed, 05 Jan 2005 21:50:03 +0000 |
| parents | 1c063814d567 |
| children | 2817a4db901d |
line wrap: on
line diff
--- a/roundup/backends/back_tsearch2.py Wed Jan 05 21:47:13 2005 +0000 +++ b/roundup/backends/back_tsearch2.py Wed Jan 05 21:50:03 2005 +0000 @@ -89,7 +89,7 @@ # This indexer never needs to reindex. def should_reindex(self): - return False + return 0 def getHits(self, search_terms, klass): return self.find(search_terms, klass) @@ -120,7 +120,7 @@ # filter out files without text/plain mime type # XXX: files without text/plain shouldn't be indexed at all, we # should take care of this in the trigger - if 'type' in klass.getprops(): + if klass.getprops().has_key('type'): nodeids = [nodeid for nodeid in nodeids if klass.get(nodeid, 'type') == 'text/plain'] @@ -159,7 +159,7 @@ default_mime_type = 'text/plain' def create(self, **propvalues): # figure the mime type - if 'type' in self.getprops() and not propvalues.get('type'): + if self.getprops().has_key('type') and not propvalues.get('type'): propvalues['type'] = self.default_mime_type return Class.create(self, **propvalues)
