Mercurial > p > roundup > code
comparison roundup/xmlrpc.py @ 5248:198b6e810c67
Use Python-3-compatible 'as' syntax for except statements
Many raise statements near these are also fixed.
So are two ivorrect file encoding marks ('utf8'->'utf-8').
| author | Eric S. Raymond <esr@thyrsus.com> |
|---|---|
| date | Thu, 24 Aug 2017 22:21:37 -0400 |
| parents | 1c792cf0a574 |
| children | db8659c4e8eb |
comparison
equal
deleted
inserted
replaced
| 5247:7f00a47b3559 | 5248:198b6e810c67 |
|---|---|
| 47 value = value.encode('utf-8') | 47 value = value.encode('utf-8') |
| 48 if value: | 48 if value: |
| 49 try: | 49 try: |
| 50 props[key] = hyperdb.rawToHyperdb(db, cl, itemid, | 50 props[key] = hyperdb.rawToHyperdb(db, cl, itemid, |
| 51 key, value) | 51 key, value) |
| 52 except hyperdb.HyperdbValueError, message: | 52 except hyperdb.HyperdbValueError as message: |
| 53 raise UsageError, message | 53 raise UsageError, message |
| 54 else: | 54 else: |
| 55 props[key] = None | 55 props[key] = None |
| 56 | 56 |
| 57 return props | 57 return props |
| 144 | 144 |
| 145 # do the actual create | 145 # do the actual create |
| 146 try: | 146 try: |
| 147 result = cl.create(**props) | 147 result = cl.create(**props) |
| 148 self.db.commit() | 148 self.db.commit() |
| 149 except (TypeError, IndexError, ValueError), message: | 149 except (TypeError, IndexError, ValueError) as message: |
| 150 raise UsageError, message | 150 raise UsageError, message |
| 151 return result | 151 return result |
| 152 | 152 |
| 153 def set(self, designator, *args): | 153 def set(self, designator, *args): |
| 154 | 154 |
| 161 raise Unauthorised('Permission to edit %s of %s denied'% | 161 raise Unauthorised('Permission to edit %s of %s denied'% |
| 162 (p, designator)) | 162 (p, designator)) |
| 163 try: | 163 try: |
| 164 result = cl.set(itemid, **props) | 164 result = cl.set(itemid, **props) |
| 165 self.db.commit() | 165 self.db.commit() |
| 166 except (TypeError, IndexError, ValueError), message: | 166 except (TypeError, IndexError, ValueError) as message: |
| 167 raise UsageError, message | 167 raise UsageError, message |
| 168 return result | 168 return result |
| 169 | 169 |
| 170 | 170 |
| 171 builtin_actions = {'retire': actions.Retire} | 171 builtin_actions = {'retire': actions.Retire} |
