Mercurial > p > roundup > code
diff roundup/xmlrpc.py @ 3840:9596a516d78c
fix compatibility with Python2.3:
try/except/finally statement first appeared in Python2.5;
add vim modeline
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Wed, 04 Apr 2007 05:11:23 +0000 |
| parents | cf6c45201980 |
| children | c31da624ae3b |
line wrap: on
line diff
--- a/roundup/xmlrpc.py Tue Apr 03 16:52:51 2007 +0000 +++ b/roundup/xmlrpc.py Wed Apr 04 05:11:23 2007 +0000 @@ -56,7 +56,7 @@ if stored != password: # Wrong password raise Unauthorised, 'Invalid user.' self.db.setCurrentUser(username) - + def close(self): """Close the database, after committing any changes, if needed.""" @@ -146,9 +146,10 @@ # do the actual create try: - result = cl.create(**props) - except (TypeError, IndexError, ValueError), message: - raise UsageError, message + try: + result = cl.create(**props) + except (TypeError, IndexError, ValueError), message: + raise UsageError, message finally: r.close() return result @@ -162,9 +163,11 @@ # convert types props = r.props_from_args(cl, args) try: - cl.set(itemid, **props) - except (TypeError, IndexError, ValueError), message: - raise UsageError, message + try: + cl.set(itemid, **props) + except (TypeError, IndexError, ValueError), message: + raise UsageError, message finally: r.close() +# vim: set et sts=4 sw=4 :
