Skip to content

Commit 470babd

Browse files
author
Johannes Gijsbers
committed
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
1 parent 7b09216 commit 470babd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

roundup/backends/back_postgresql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def open_connection(self):
106106
try:
107107
self.load_dbschema()
108108
except psycopg.ProgrammingError, message:
109-
if '"schema" does not exist' not in str(message):
109+
if str(message).find('"schema" does not exist') == -1:
110110
raise
111111
self.rollback()
112112
self.init_dbschema()

roundup/backends/back_tsearch2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(self, db):
8989

9090
# This indexer never needs to reindex.
9191
def should_reindex(self):
92-
return False
92+
return 0
9393

9494
def getHits(self, search_terms, klass):
9595
return self.find(search_terms, klass)
@@ -120,7 +120,7 @@ def tsearchQuery(self, classname, search_terms):
120120
# filter out files without text/plain mime type
121121
# XXX: files without text/plain shouldn't be indexed at all, we
122122
# should take care of this in the trigger
123-
if 'type' in klass.getprops():
123+
if klass.getprops().has_key('type'):
124124
nodeids = [nodeid for nodeid in nodeids
125125
if klass.get(nodeid, 'type') == 'text/plain']
126126

@@ -159,7 +159,7 @@ def __init__(self, db, classname, **properties):
159159
default_mime_type = 'text/plain'
160160
def create(self, **propvalues):
161161
# figure the mime type
162-
if 'type' in self.getprops() and not propvalues.get('type'):
162+
if self.getprops().has_key('type') and not propvalues.get('type'):
163163
propvalues['type'] = self.default_mime_type
164164
return Class.create(self, **propvalues)
165165

0 commit comments

Comments
 (0)