Updated get parameters inside Account class.
authorRagner Magalhaes <ragner.magalhaes@openbossa.org>
Tue, 2 Dec 2008 21:09:44 +0000 (21:09 +0000)
committerAnderson Briglia <anderson.briglia@openbossa.org>
Sat, 28 Feb 2009 21:11:18 +0000 (17:11 -0400)
FIXES:
 - When using property, "set_*" methods didn't return anything, so whe
   couldn't know if the operation was successful or not. Because of
   this, I've moved them into separate methods outside of the property
   (like username and protocol_id).

Signed-off-by: Bruno Abinader <bruno.abinader@indt.org.br>
Acked-by: Ricardo Guimaraes <ricardo.guimaraes@indt.org.br>

git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1414 596f6dd7-e928-0410-a184-9e12fd12cf7e

account.pyx

index bd2eb44..d5f5ef2 100644 (file)
@@ -82,14 +82,7 @@ cdef class Account:
                 return None
         else:
             return None
-    def __set_password(self, password):
-        if self.__exists:
-            account.purple_account_set_password(self._get_structure(), \
-                    password)
-            return True
-        else:
-            return False
-    password = property(__get_password, __set_password)
+    password = property(__get_password)
 
     def __get_alias(self):
         cdef char *alias = NULL
@@ -101,14 +94,7 @@ cdef class Account:
                 return None
         else:
             return None
-    def __set_alias(self, alias):
-        if self.__exists:
-            account.purple_account_set_alias(self._get_structure(), \
-                    alias)
-            return True
-        else:
-            return False
-    alias = property(__get_alias, __set_alias)
+    alias = property(__get_alias)
 
     def __get_user_info(self):
         cdef char *user_info = NULL
@@ -120,14 +106,7 @@ cdef class Account:
                 return None
         else:
             return None
-    def __set_user_info(self, user_info):
-        if self.__exists:
-            account.purple_account_set_user_info(self._get_structure(), \
-                    user_info)
-            return True
-        else:
-            return False
-    user_info = property(__get_user_info, __set_user_info)
+    user_info = property(__get_user_info)
 
     def __get_remember_password(self):
         if self.__exists:
@@ -135,15 +114,7 @@ cdef class Account:
                     self._get_structure())
         else:
             return None
-    def __set_remember_password(self, remember_password):
-        if self.__exists:
-            account.purple_account_set_remember_password( \
-                self._get_structure(), remember_password)
-            return True
-        else:
-            return False
-    remember_password = property(__get_remember_password, \
-            __set_remember_password)
+    remember_password = property(__get_remember_password)
 
     def set_username(self, username):
         if self.__exists:
@@ -160,6 +131,38 @@ cdef class Account:
         else:
             return False
 
+    def set_password(self, password):
+        if self.__exists:
+            account.purple_account_set_password(self._get_structure(), \
+                    password)
+            return True
+        else:
+            return False
+
+    def set_alias(self, alias):
+        if self.__exists:
+            account.purple_account_set_alias(self._get_structure(), \
+                    alias)
+            return True
+        else:
+            return False
+
+    def set_user_info(self, user_info):
+        if self.__exists:
+            account.purple_account_set_user_info(self._get_structure(), \
+                    user_info)
+            return True
+        else:
+            return False
+
+    def set_remember_password(self, remember_password):
+        if self.__exists:
+            account.purple_account_set_remember_password( \
+                self._get_structure(), remember_password)
+            return True
+        else:
+            return False
+
     def new(self):
         if self.__exists:
             return False