changeset 1694:3c608d660f0b

core (memory): profile is checked in startSession (an error is raised if it doesn't exist)
author Goffi <goffi@goffi.org>
date Fri, 27 Nov 2015 16:50:29 +0100
parents 35426d58471c
children 5a93f13c1e76
files src/core/sat_main.py src/memory/memory.py
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/sat_main.py	Fri Nov 27 16:48:41 2015 +0100
+++ b/src/core/sat_main.py	Fri Nov 27 16:50:29 2015 +0100
@@ -74,7 +74,7 @@
         self.bridge.register("getEntitiesData", self.memory._getEntitiesData)
         self.bridge.register("asyncCreateProfile", self.memory.asyncCreateProfile)
         self.bridge.register("asyncDeleteProfile", self.memory.asyncDeleteProfile)
-        self.bridge.register("profileStartSession", self.memory._startSession)
+        self.bridge.register("profileStartSession", self.memory.startSession)
         self.bridge.register("profileIsSessionStarted", self.memory._isSessionStarted)
         self.bridge.register("profileSetDefault", self.memory.profileSetDefault)
         self.bridge.register("asyncConnect", self._asyncConnect)
--- a/src/memory/memory.py	Fri Nov 27 16:48:41 2015 +0100
+++ b/src/memory/memory.py	Fri Nov 27 16:50:29 2015 +0100
@@ -318,17 +318,17 @@
 
     ## Profiles/Sessions management ##
 
-    def _startSession(self, password, profile_key):
-        profile = self.getProfileName(profile_key)
-        return self.startSession(password, profile)
-
     def startSession(self, password, profile):
         """"Iniatialise session for a profile
 
         @param password(unicode): profile session password
             or empty string is no password is set
         @param profile: %(doc_profile)s
+        @raise exceptions.ProfileUnknownError if profile doesn't exists
+        @raise exceptions.PasswordError: the password does not match
         """
+        profile = self.getProfileName(profile)
+
         def createSession(dummy):
             """Called once params are loaded."""
             self._entities_cache[profile] = {}