comparison sat_pubsub/backend.py @ 490:cab491b1b563

backend: check items elements on publish.
author Goffi <goffi@goffi.org>
date Thu, 21 Nov 2024 11:02:09 +0100
parents 70eddf92bf51
children
comparison
equal deleted inserted replaced
489:fa0d2a4783fa 490:cab491b1b563
465 465
466 items_data = [] 466 items_data = []
467 check_overwrite = False 467 check_overwrite = False
468 ret_payload = None # payload returned, None or domish.Element 468 ret_payload = None # payload returned, None or domish.Element
469 for item in items: 469 for item in items:
470 if item.name != "item" or item.uri != pubsub.NS_PUBSUB:
471 raise error.NotAllowedError(f"Invalid item: {item.toXml()}")
470 # we enforce publisher (cf XEP-0060 §7.1.2.3) 472 # we enforce publisher (cf XEP-0060 §7.1.2.3)
471 item['publisher'] = requestor.full() 473 item['publisher'] = requestor.full()
472 if persistItems or deliverPayloads: 474 if persistItems or deliverPayloads:
473 item.uri = None 475 item.uri = None
474 item.defaultUri = None 476 item.defaultUri = None