Mercurial > libervia-pubsub
diff idavoll/pubsub.py @ 147:fee92e499d6d
Changed Data Forms implementation to support all field types and
options in case of list-single and list-multi.
Strip the options before returning meta data in disco#info request to a node.
Fix error handling in disco#info handling to not mask unexpected exceptions.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Fri, 29 Jul 2005 15:38:29 +0000 |
parents | d2c18d88f618 |
children | 043f2e5ce8cd |
line wrap: on
line diff
--- a/idavoll/pubsub.py Fri Jul 29 15:33:43 2005 +0000 +++ b/idavoll/pubsub.py Fri Jul 29 15:38:29 2005 +0000 @@ -153,12 +153,13 @@ return defer.succeed(info) else: - try: - d = self.backend.get_node_type(node) - d.addCallback(self._add_identity, [], node) - d.addErrback(lambda _: []) - except storage.NodeNotFound: - return defer.succeed([]) + def trap_not_found(result): + result.trap(storage.NodeNotFound) + return [] + + d = self.backend.get_node_type(node) + d.addCallback(self._add_identity, [], node) + d.addErrback(trap_not_found) return d def _add_identity(self, node_type, result_list, node): @@ -169,12 +170,19 @@ def _add_meta_data(self, meta_data, node_type, result_list): form = data_form.Form(type="result", form_type=NS_PUBSUB + "#meta-data") + for meta_datum in meta_data: - form.add_field_single(**meta_datum) - form.add_field_single("text-single", - "pubsub#node_type", - "The type of node (collection or leaf)", - node_type) + try: + del meta_datum['options'] + except KeyError: + pass + + form.add_field(**meta_datum) + + form.add_field("text-single", + "pubsub#node_type", + "The type of node (collection or leaf)", + node_type) result_list.append(form) return result_list @@ -376,7 +384,7 @@ form_type=NS_PUBSUB + "#node_config") for option in options: - form.add_field_single(**option) + form.add_field(**option) form.parent = configure configure.addChild(form)