core: exceptions moved to core
plugin group blog: group blog now manage public microblogs
This commit is contained in:
parent
723b468fcc
commit
52b00f6d6f
3 changed files with 57 additions and 41 deletions
23
src/core/exceptions.py
Normal file
23
src/core/exceptions.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
SàT Exceptions
|
||||
Copyright (C) 2011 Jérôme Poisson (goffi@goffi.org)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
class ProfileUnknownError(Exception):
|
||||
pass
|
||||
|
|
@ -43,6 +43,7 @@ import sys
|
|||
import os.path
|
||||
|
||||
from sat.core import xmpp
|
||||
from sat.core.exceptions import ProfileUnknownError
|
||||
from sat.memory.memory import Memory
|
||||
from sat.tools.xml_tools import tupleList2dataForm
|
||||
from sat.tools.misc import TriggerManager
|
||||
|
|
@ -213,7 +214,7 @@ class SAT(service.Service):
|
|||
profile = self.memory.getProfileName(profile_key)
|
||||
if not profile:
|
||||
error (_('Trying to connect a non-exsitant profile'))
|
||||
return defer.fail()
|
||||
raise ProfileUnknownError(profile_key)
|
||||
|
||||
if (self.isConnected(profile)):
|
||||
info(_("already connected !"))
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
|
|||
bare_jid = item.jid.userhost()
|
||||
self._jids[bare_jid] = item
|
||||
for group in item.groups:
|
||||
self._groups.get(group,set()).add(bare_jid)
|
||||
self._groups.setdefault(group,set()).add(bare_jid)
|
||||
self.host.bridge.newContact(item.jid.full(), self.getAttributes(item), item.groups, self.parent.profile)
|
||||
|
||||
def onRosterRemove(self, entity):
|
||||
|
|
|
|||
Loading…
Reference in a new issue