Mercurial > p > roundup > code
changeset 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 | 53d1d4e2015c |
| children | c4e76c84f43d |
| files | roundup/backends/back_postgresql.py roundup/backends/back_tsearch2.py |
| diffstat | 2 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/roundup/backends/back_postgresql.py Wed Jan 05 21:47:13 2005 +0000 +++ b/roundup/backends/back_postgresql.py Wed Jan 05 21:50:03 2005 +0000 @@ -106,7 +106,7 @@ try: self.load_dbschema() except psycopg.ProgrammingError, message: - if '"schema" does not exist' not in str(message): + if str(message).find('"schema" does not exist') == -1: raise self.rollback() self.init_dbschema()
--- 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)
