Skip to content

Commit d77fbc7

Browse files
author
Alexander Smishlajev
committed
fix compatibility with Python2.3:
try/except/finally statement first appeared in Python2.5; add vim modeline
1 parent da3bc8b commit d77fbc7

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

roundup/xmlrpc.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(self, tracker, username, password):
5656
if stored != password: # Wrong password
5757
raise Unauthorised, 'Invalid user.'
5858
self.db.setCurrentUser(username)
59-
59+
6060
def close(self):
6161
"""Close the database, after committing any changes, if needed."""
6262

@@ -146,9 +146,10 @@ def create(self, username, password, classname, *args):
146146

147147
# do the actual create
148148
try:
149-
result = cl.create(**props)
150-
except (TypeError, IndexError, ValueError), message:
151-
raise UsageError, message
149+
try:
150+
result = cl.create(**props)
151+
except (TypeError, IndexError, ValueError), message:
152+
raise UsageError, message
152153
finally:
153154
r.close()
154155
return result
@@ -162,9 +163,11 @@ def set(self, username, password, designator, *args):
162163
# convert types
163164
props = r.props_from_args(cl, args)
164165
try:
165-
cl.set(itemid, **props)
166-
except (TypeError, IndexError, ValueError), message:
167-
raise UsageError, message
166+
try:
167+
cl.set(itemid, **props)
168+
except (TypeError, IndexError, ValueError), message:
169+
raise UsageError, message
168170
finally:
169171
r.close()
170172

173+
# vim: set et sts=4 sw=4 :

0 commit comments

Comments
 (0)