Mercurial > p > roundup > code
comparison roundup/xmlrpc.py @ 4224:3f6cadb98c2f
Move db.commit() call from handle_xmlrpc() to individual methods...
...so actions can control it themselves.
| author | Stefan Seefeld <stefan@seefeld.name> |
|---|---|
| date | Sun, 19 Jul 2009 22:56:30 +0000 |
| parents | 3c4545f55949 |
| children | 712549bb7fe5 |
comparison
equal
deleted
inserted
replaced
| 4215:57dfcc824acc | 4224:3f6cadb98c2f |
|---|---|
| 118 raise Unauthorised('Permission to set %s.%s denied'%(classname, key)) | 118 raise Unauthorised('Permission to set %s.%s denied'%(classname, key)) |
| 119 | 119 |
| 120 # do the actual create | 120 # do the actual create |
| 121 try: | 121 try: |
| 122 result = cl.create(**props) | 122 result = cl.create(**props) |
| 123 self.db.commit() | |
| 123 except (TypeError, IndexError, ValueError), message: | 124 except (TypeError, IndexError, ValueError), message: |
| 124 raise UsageError, message | 125 raise UsageError, message |
| 125 return result | 126 return result |
| 126 | 127 |
| 127 def set(self, designator, *args): | 128 def set(self, designator, *args): |
| 133 if not self.db.security.hasPermission('Edit', self.db.getuid(), | 134 if not self.db.security.hasPermission('Edit', self.db.getuid(), |
| 134 classname, p, itemid): | 135 classname, p, itemid): |
| 135 raise Unauthorised('Permission to edit %s of %s denied'% | 136 raise Unauthorised('Permission to edit %s of %s denied'% |
| 136 (p, designator)) | 137 (p, designator)) |
| 137 try: | 138 try: |
| 138 return cl.set(itemid, **props) | 139 result = cl.set(itemid, **props) |
| 140 self.db.commit() | |
| 139 except (TypeError, IndexError, ValueError), message: | 141 except (TypeError, IndexError, ValueError), message: |
| 140 raise UsageError, message | 142 raise UsageError, message |
| 143 return result | |
| 141 | 144 |
| 142 | 145 |
| 143 builtin_actions = {'retire': actions.Retire} | 146 builtin_actions = {'retire': actions.Retire} |
| 144 | 147 |
| 145 def action(self, name, *args): | 148 def action(self, name, *args): |
