comparison src/plugins/plugin_misc_groupblog.py @ 941:c6d8fc63b1db

core, plugins: host.getClient now raise an exception instead of returning None when no profile is found, plugins have been adapted consequently and a bit cleaned
author Goffi <goffi@goffi.org>
date Fri, 28 Mar 2014 18:07:02 +0100
parents fc7e0828b18e
children e1842ebcb2f3
comparison
equal deleted inserted replaced
940:92e41e7c7e00 941:c6d8fc63b1db
152 profile = self.host.memory.getProfileName(profile_key) 152 profile = self.host.memory.getProfileName(profile_key)
153 if not profile: 153 if not profile:
154 raise exceptions.ProfileUnknownError 154 raise exceptions.ProfileUnknownError
155 155
156 client = self.host.getClient(profile) 156 client = self.host.getClient(profile)
157 if not client:
158 error(_('No client for this profile key: %s') % profile_key)
159 raise Exception("Unknown profile")
160 yield client.client_initialized # we want to be sure that the client is initialized 157 yield client.client_initialized # we want to be sure that the client is initialized
161 158
162 #we first check that we have a item-access pubsub server 159 #we first check that we have a item-access pubsub server
163 if not hasattr(client, "item_access_pubsub"): 160 if not hasattr(client, "item_access_pubsub"):
164 debug(_('Looking for item-access power pubsub server')) 161 debug(_('Looking for item-access power pubsub server'))
307 _options[P.OPT_ROSTER_GROUPS_ALLOWED] = list(access_list) 304 _options[P.OPT_ROSTER_GROUPS_ALLOWED] = list(access_list)
308 305
309 # FIXME: check comments node creation success, at the moment this is a potential security risk (if the node 306 # FIXME: check comments node creation success, at the moment this is a potential security risk (if the node
310 # already exists, the creation will silently fail, but the comments link will stay the same, linking to a 307 # already exists, the creation will silently fail, but the comments link will stay the same, linking to a
311 # node owned by somebody else) 308 # node owned by somebody else)
312 defer_blog = self.host.plugins["XEP-0060"].createNode(service, comments_node, _options, profile_key=client.profile) 309 self.host.plugins["XEP-0060"].createNode(service, comments_node, _options, profile_key=client.profile)
313 310
314 def itemCreated(mblog_item): 311 def itemCreated(mblog_item):
315 form = data_form.Form('submit', formNamespace=NS_PUBSUB_ITEM_CONFIG) 312 form = data_form.Form('submit', formNamespace=NS_PUBSUB_ITEM_CONFIG)
316 313
317 if access_type == "PUBLIC": 314 if access_type == "PUBLIC":