Mercurial > libervia-backend
comparison src/memory/memory.py @ 645:17bd09cd1001
core: misc bug fixes
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 21 Sep 2013 15:34:10 +0200 |
parents | 262d9d9ad27a |
children | 7d6e5807504a |
comparison
equal
deleted
inserted
replaced
644:53de6954e94e | 645:17bd09cd1001 |
---|---|
23 from ConfigParser import SafeConfigParser, NoOptionError, NoSectionError | 23 from ConfigParser import SafeConfigParser, NoOptionError, NoSectionError |
24 from xml.dom import minidom | 24 from xml.dom import minidom |
25 from logging import debug, info, warning, error | 25 from logging import debug, info, warning, error |
26 from twisted.internet import defer | 26 from twisted.internet import defer |
27 from twisted.words.protocols.jabber import jid | 27 from twisted.words.protocols.jabber import jid |
28 from twisted.python.failure import Failure | |
28 from sat.tools.xml_tools import paramsXml2xmlUI | 29 from sat.tools.xml_tools import paramsXml2xmlUI |
29 from sat.core.default_config import default_config | 30 from sat.core.default_config import default_config |
30 from sat.memory.sqlite import SqliteStorage | 31 from sat.memory.sqlite import SqliteStorage |
31 from sat.memory.persistent import PersistentDict | 32 from sat.memory.persistent import PersistentDict |
32 from sat.core import exceptions | 33 from sat.core import exceptions |
159 - CONFLICT: the profile already exists | 160 - CONFLICT: the profile already exists |
160 - CANCELED: profile creation canceled | 161 - CANCELED: profile creation canceled |
161 """ | 162 """ |
162 if self.storage.hasProfile(profile): | 163 if self.storage.hasProfile(profile): |
163 info(_('The profile name already exists')) | 164 info(_('The profile name already exists')) |
164 return defer.fail("CONFLICT") | 165 return defer.fail(Failure(u"CONFLICT")) |
165 if not self.host.trigger.point("ProfileCreation", profile): | 166 if not self.host.trigger.point("ProfileCreation", profile): |
166 return defer.fail("CANCEL") | 167 return defer.fail(Failure(u"CANCEL")) |
167 return self.storage.createProfile(profile) | 168 return self.storage.createProfile(profile) |
168 | 169 |
169 def deleteProfile(self, profile): | 170 def deleteProfile(self, profile): |
170 """Delete an existing profile | 171 """Delete an existing profile |
171 @param profile: name of the profile""" | 172 @param profile: name of the profile""" |