~hudson-openstack/burrow/trunk

« back to all changes in this revision

Viewing changes to burrow/backend/memory.py

  • Committer: Tarmac
  • Author(s): Eric Day
  • Date: 2011-08-24 20:23:03 UTC
  • mfrom: (33.1.7 doc-updates)
  • Revision ID: tarmac-20110824202303-fc09r0aendi1tn6m
Added client API unit tests, moved exceptions to main burrow module, and added more WSGI frontend tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
        try:
111
111
            message = queue.messages.get(message)
112
112
            created = False
113
 
        except burrow.backend.NotFound:
 
113
        except burrow.NotFound:
114
114
            message = queue.messages.get(message, True)
115
115
            created = True
116
116
        message.ttl = ttl
226
226
            return self.index[id]
227
227
        elif create:
228
228
            return self.add(self.item_class(id))
229
 
        raise burrow.backend.NotFound()
 
229
        raise burrow.NotFound(self.item_class.__name__ + " not found")
230
230
 
231
231
    def iter(self, filters=None):
232
232
        '''Iterate through all items in the list, possibly filtered.'''
241
241
        else:
242
242
            item = self.first
243
243
        if item is None:
244
 
            raise burrow.backend.NotFound()
 
244
            raise burrow.NotFound(self.item_class.__name__ + " not found")
245
245
        while item is not None:
246
246
            yield item
247
247
            if limit:
253
253
    def reset(self):
254
254
        '''Remove all items in the list.'''
255
255
        if self.count() == 0:
256
 
            raise burrow.backend.NotFound()
 
256
            raise burrow.NotFound(self.item_class.__name__ + " not found")
257
257
        self.first = None
258
258
        self.last = None
259
259
        self.index.clear()
287
287
        elif create:
288
288
            account = self.add(Account(account))
289
289
        else:
290
 
            raise burrow.backend.NotFound()
 
290
            raise burrow.NotFound('Account not found')
291
291
        return account, account.queues.get(queue, create)
292
292
 
293
293
 
361
361
                        break
362
362
            item = item.next
363
363
        if count == 0:
364
 
            raise burrow.backend.NotFound()
 
364
            raise burrow.NotFound('Message not found')