diff src/memory/params.py @ 938:fc7e0828b18e

plugin account, groupblog: user can erase all their microblogs at once
author souliane <souliane@mailoo.org>
date Thu, 27 Mar 2014 02:24:20 +0100
parents 1a759096ccbd
children e1842ebcb2f3
line wrap: on
line diff
--- a/src/memory/params.py	Tue Mar 25 17:26:31 2014 +0100
+++ b/src/memory/params.py	Thu Mar 27 02:24:20 2014 +0100
@@ -154,9 +154,12 @@
         if not self.storage.hasProfile(profile):
             info(_('Trying to delete an unknown profile'))
             return defer.fail(Failure(exceptions.ProfileUnknownError))
-        if not force and self.host.isConnected(profile):
-            info(_("Trying to delete a connected profile"))
-            return defer.fail(Failure(exceptions.ConnectedProfileError))
+        if self.host.isConnected(profile):
+            if force:
+                self.host.disconnect(profile)
+            else:
+                info(_("Trying to delete a connected profile"))
+                return defer.fail(Failure(exceptions.ConnectedProfileError))
         return self.storage.deleteProfile(profile)
 
     def getProfileName(self, profile_key, return_profile_keys = False):