comparison idavoll/backend.py @ 98:b9c449f4c167

Removed debugging junk
author Ralph Meijer <ralphm@ik.nu>
date Wed, 24 Nov 2004 20:08:28 +0000
parents 3ad74552bbc7
children b75fcc554358
comparison
equal deleted inserted replaced
97:cf918d581da5 98:b9c449f4c167
215 if items and not persist_items and not deliver_payloads: 215 if items and not persist_items and not deliver_payloads:
216 raise NoPayloadAllowed 216 raise NoPayloadAllowed
217 elif not items and (persist_items or deliver_payloads): 217 elif not items and (persist_items or deliver_payloads):
218 raise PayloadExpected 218 raise PayloadExpected
219 219
220 print "publish by %s to %s" % (requestor.full(), node_id)
221
222 if persist_items or deliver_payloads: 220 if persist_items or deliver_payloads:
223 for item in items: 221 for item in items:
224 if not item.getAttribute("id"): 222 if not item.getAttribute("id"):
225 item["id"] = sha.new(str(time.time()) + 223 item["id"] = sha.new(str(time.time()) +
226 requestor.full()).hexdigest() 224 requestor.full()).hexdigest()
410 d = self.parent.storage.is_subscribed(node_id, requestor) 408 d = self.parent.storage.is_subscribed(node_id, requestor)
411 d.addCallback(self._do_get_items, node_id, max_items, item_ids) 409 d.addCallback(self._do_get_items, node_id, max_items, item_ids)
412 return d 410 return d
413 411
414 def _do_get_items(self, result, node_id, max_items, item_ids): 412 def _do_get_items(self, result, node_id, max_items, item_ids):
415 def q(r):
416 print r
417 return r
418
419 if not result: 413 if not result:
420 raise NotAuthorized 414 raise NotAuthorized
421 415
422 if item_ids: 416 if item_ids:
423 d = self.parent.storage.get_items_by_ids(node_id, item_ids) 417 return self.parent.storage.get_items_by_ids(node_id, item_ids)
424 d.addCallback(q)
425 d.addErrback(q)
426 return d
427 else: 418 else:
428 return self.parent.storage.get_items(node_id, max_items) 419 return self.parent.storage.get_items(node_id, max_items)
429 420
430 class RetractionService(service.Service): 421 class RetractionService(service.Service):
431 422