comparison idavoll/gateway.py @ 186:365fd3e4daf8

Add maxItems support.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 16 Apr 2008 14:14:27 +0000
parents 9038908dc2f5
children 69cdd8c6a431
comparison
equal deleted inserted replaced
185:9038908dc2f5 186:365fd3e4daf8
585 if not failure.value.condition == 'item-not-found': 585 if not failure.value.condition == 'item-not-found':
586 raise failure 586 raise failure
587 return http.StatusResponse(responsecode.NOT_FOUND, 587 return http.StatusResponse(responsecode.NOT_FOUND,
588 "Node not found") 588 "Node not found")
589 589
590 d = self.service.items(jid, nodeIdentifier) 590 d = self.service.items(jid, nodeIdentifier, maxItems)
591 d.addCallback(respond) 591 d.addCallback(respond)
592 d.addErrback(trapNotFound) 592 d.addErrback(trapNotFound)
593 return d 593 return d
594 594
595 595
720 720
721 721
722 def items(self, xmppURI, maxItems=None): 722 def items(self, xmppURI, maxItems=None):
723 query = {'uri': xmppURI} 723 query = {'uri': xmppURI}
724 if maxItems: 724 if maxItems:
725 query['maxItems'] = int(maxItems) 725 query['max_items'] = int(maxItems)
726 f = getPageWithFactory(self._makeURI('items', query), 726 f = getPageWithFactory(self._makeURI('items', query),
727 method='GET', 727 method='GET',
728 agent=self.agent) 728 agent=self.agent)
729 return f.deferred 729 return f.deferred