From 8a65818786ccf9442ed68927ddb9922465a424b4 Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 20:41:10 +0000 Subject: [PATCH 1/1] blist_cbs.pxd: adding try/except in right position Signed-off-by: Anderson Briglia git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1338 596f6dd7-e928-0410-a184-9e12fd12cf7e --- blist_cbs.pxd | 84 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/blist_cbs.pxd b/blist_cbs.pxd index 96268a4..763cf51 100644 --- a/blist_cbs.pxd +++ b/blist_cbs.pxd @@ -101,21 +101,21 @@ cdef void new_list (blist.PurpleBuddyList *list): cdef void new_node (blist.PurpleBlistNode *node): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "new_node\n") - if node.type == blist.PURPLE_BLIST_GROUP_NODE: - __group_node_cb(node, blist_cbs["new_node"]) - elif node.type == blist.PURPLE_BLIST_CONTACT_NODE: - __contact_node_cb(node, blist_cbs["new_node"]) - elif node.type == blist.PURPLE_BLIST_BUDDY_NODE: - __buddy_node_cb(node, blist_cbs["new_node"]) - elif node.type == blist.PURPLE_BLIST_CHAT_NODE: - __chat_node_cb(node, blist_cbs["new_node"]) - elif node.type == blist.PURPLE_BLIST_OTHER_NODE: - __other_node_cb(node, blist_cbs["new_node"]) - else: - try: + try: + if node.type == blist.PURPLE_BLIST_GROUP_NODE: + __group_node_cb(node, blist_cbs["new_node"]) + elif node.type == blist.PURPLE_BLIST_CONTACT_NODE: + __contact_node_cb(node, blist_cbs["new_node"]) + elif node.type == blist.PURPLE_BLIST_BUDDY_NODE: + __buddy_node_cb(node, blist_cbs["new_node"]) + elif node.type == blist.PURPLE_BLIST_CHAT_NODE: + __chat_node_cb(node, blist_cbs["new_node"]) + elif node.type == blist.PURPLE_BLIST_OTHER_NODE: + __other_node_cb(node, blist_cbs["new_node"]) + else: (blist_cbs["new_node"])(node.type) - except KeyError: - pass + except KeyError: + pass cdef void show (blist.PurpleBuddyList *list): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "show\n") @@ -127,40 +127,40 @@ cdef void show (blist.PurpleBuddyList *list): cdef void update (blist.PurpleBuddyList *list, blist.PurpleBlistNode *node): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "update\n") - if node.type == blist.PURPLE_BLIST_GROUP_NODE: - __group_node_cb(node, blist_cbs["update"]) - elif node.type == blist.PURPLE_BLIST_CONTACT_NODE: - __contact_node_cb(node, blist_cbs["update"]) - elif node.type == blist.PURPLE_BLIST_BUDDY_NODE: - __buddy_node_cb(node, blist_cbs["update"]) - elif node.type == blist.PURPLE_BLIST_CHAT_NODE: - __chat_node_cb(node, blist_cbs["update"]) - elif node.type == blist.PURPLE_BLIST_OTHER_NODE: - __other_node_cb(node, blist_cbs["update"]) - else: - try: + try: + if node.type == blist.PURPLE_BLIST_GROUP_NODE: + __group_node_cb(node, blist_cbs["update"]) + elif node.type == blist.PURPLE_BLIST_CONTACT_NODE: + __contact_node_cb(node, blist_cbs["update"]) + elif node.type == blist.PURPLE_BLIST_BUDDY_NODE: + __buddy_node_cb(node, blist_cbs["update"]) + elif node.type == blist.PURPLE_BLIST_CHAT_NODE: + __chat_node_cb(node, blist_cbs["update"]) + elif node.type == blist.PURPLE_BLIST_OTHER_NODE: + __other_node_cb(node, blist_cbs["update"]) + else: (blist_cbs["update"])(node.type) - except KeyError: - pass + except KeyError: + pass cdef void remove (blist.PurpleBuddyList *list, blist.PurpleBlistNode *node): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "remove\n") - if node.type == blist.PURPLE_BLIST_GROUP_NODE: - __group_node_cb(node, blist_cbs["remove"]) - elif node.type == blist.PURPLE_BLIST_CONTACT_NODE: - __contact_node_cb(node, blist_cbs["remove"]) - elif node.type == blist.PURPLE_BLIST_BUDDY_NODE: - __buddy_node_cb(node, blist_cbs["remove"]) - elif node.type == blist.PURPLE_BLIST_CHAT_NODE: - __chat_node_cb(node, blist_cbs["remove"]) - elif node.type == blist.PURPLE_BLIST_OTHER_NODE: - __other_node_cb(node, blist_cbs["remove"]) - else: - try: + try: + if node.type == blist.PURPLE_BLIST_GROUP_NODE: + __group_node_cb(node, blist_cbs["remove"]) + elif node.type == blist.PURPLE_BLIST_CONTACT_NODE: + __contact_node_cb(node, blist_cbs["remove"]) + elif node.type == blist.PURPLE_BLIST_BUDDY_NODE: + __buddy_node_cb(node, blist_cbs["remove"]) + elif node.type == blist.PURPLE_BLIST_CHAT_NODE: + __chat_node_cb(node, blist_cbs["remove"]) + elif node.type == blist.PURPLE_BLIST_OTHER_NODE: + __other_node_cb(node, blist_cbs["remove"]) + else: (blist_cbs["remove"])(node.type) - except KeyError: - pass + except KeyError: + pass cdef void destroy (blist.PurpleBuddyList *list): debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "blist", "destroy\n") -- 1.7.9.5