Skip to content

Commit 06871da

Browse files
author
Richard Jones
committed
fixes for py2.1 (booleans, sigh)
1 parent 75b3a04 commit 06871da

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

roundup/backends/back_mysql.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,12 @@ def filter(self, search_matches, filterspec, sort=(None,None),
522522
where = []
523523
args = []
524524
a = self.db.arg
525-
mlfilt = False
525+
mlfilt = 0
526526
for k, v in filterspec.items():
527527
propclass = props[k]
528528
# now do other where clause stuff
529529
if isinstance(propclass, Multilink):
530-
mlfilt = True
530+
mlfilt = 1
531531
tn = '%s_%s'%(cn, k)
532532
if v in ('-1', ['-1']):
533533
# only match rows that have count(linkid)=0 in the
@@ -591,20 +591,21 @@ def filter(self, search_matches, filterspec, sort=(None,None),
591591
where.append('_%s=%s'%(k, a))
592592
args.append(v)
593593
elif isinstance(propclass, Date):
594+
dc = self.db.hyperdb_to_sql_value[hyperdb.Date]
594595
if isinstance(v, type([])):
595596
s = ','.join([a for x in v])
596597
where.append('_%s in (%s)'%(k, s))
597-
args = args + [date.Date(x).serialise() for x in v]
598+
args = args + [dc(date.Date(x)) for x in v]
598599
else:
599600
try:
600601
# Try to filter on range of dates
601602
date_rng = Range(v, date.Date, offset=timezone)
602-
if (date_rng.from_value):
603+
if date_rng.from_value:
603604
where.append('_%s >= %s'%(k, a))
604-
args.append(date_rng.from_value.serialise())
605-
if (date_rng.to_value):
605+
args.append(dc(date_rng.from_value))
606+
if date_rng.to_value:
606607
where.append('_%s <= %s'%(k, a))
607-
args.append(date_rng.to_value.serialise())
608+
args.append(dc(date_rng.to_value))
608609
except ValueError:
609610
# If range creation fails - ignore that search parameter
610611
pass

roundup/backends/back_postgresql.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ def db_nuke(config, fail_ok=0):
2828
command = 'DROP DATABASE %s'% config.POSTGRESQL_DATABASE['database']
2929
db_command(config, command)
3030

31+
if os.path.exists(config.DATABASE):
32+
shutil.rmtree(config.DATABASE)
33+
3134
def db_command(config, command):
3235
'''Perform some sort of database-level command. Retry 10 times if we
3336
fail by conflicting with another user.

roundup/backends/rdbms_common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.97 2004-05-04 05:56:48 richard Exp $
1+
# $Id: rdbms_common.py,v 1.98 2004-05-06 01:12:22 richard Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -2002,12 +2002,12 @@ def filter(self, search_matches, filterspec, sort=(None,None),
20022002
where = []
20032003
args = []
20042004
a = self.db.arg
2005-
mlfilt = False # are we joining with Multilink tables?
2005+
mlfilt = 0 # are we joining with Multilink tables?
20062006
for k, v in filterspec.items():
20072007
propclass = props[k]
20082008
# now do other where clause stuff
20092009
if isinstance(propclass, Multilink):
2010-
mlfilt = True
2010+
mlfilt = 1
20112011
tn = '%s_%s'%(cn, k)
20122012
if v in ('-1', ['-1']):
20132013
# only match rows that have count(linkid)=0 in the

roundup/scripts/roundup_mailgw.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1515
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1616
#
17-
# $Id: roundup_mailgw.py,v 1.14 2004-04-13 04:14:03 richard Exp $
17+
# $Id: roundup_mailgw.py,v 1.15 2004-05-06 01:12:24 richard Exp $
1818

1919
"""Command-line script stub that calls the roundup.mailgw.
2020
"""
@@ -162,9 +162,9 @@ def main(argv):
162162
m = re.match(r'((?P<user>[^:]+)(:(?P<pass>.+))?@)?(?P<server>.+)',
163163
specification)
164164
if m:
165-
ssl = False
165+
ssl = 0
166166
if source == 'imaps':
167-
ssl = True
167+
ssl = 1
168168
mailbox = ''
169169
if len(args) > 3:
170170
mailbox = args[3]

0 commit comments

Comments
 (0)