diaspy.connection.Connection.login() returns Connection() object as well
authorMarek Marecki <marekjm@taistelu.com>
Sat, 14 Sep 2013 22:27:00 +0000 (00:27 +0200)
committerMarek Marecki <marekjm@taistelu.com>
Sat, 14 Sep 2013 22:27:00 +0000 (00:27 +0200)
as modifying it in-place

Changelog.markdown
diaspy/connection.py

index a1af97a51199d62c1b19639ae4affb8b73e242fa..56322f0467dcb6a99867f823334875854286b23e 100644 (file)
@@ -31,6 +31,10 @@ up-to-date than manual and if conflicts appear they should follow the order:
 
 * __new__:  `diaspy.people.User._fetchstream()` method,
 
+* __upd__:  `diaspy.connection.Connection.login()` modifies connection object in-place **and** returns it (this allows more fluent API),
+* __upd__:  `diaspy.connection.Connection.login()` no longer returns status code (if login was unsuccessful it'll raise an exception),
+* __upd__:  `diaspy.connection.Connection._login()` no longer returns status code (if login was unsuccessful it'll raise an exception),
+
 
 ----
 
index baec218808328592cbdb4724093f5decc7365245..50b1d44cf0577f2c05edbbba93904c315c0d1a76 100644 (file)
@@ -147,7 +147,6 @@ class Connection():
                             allow_redirects=False)
         if request.status_code != 302:
             raise errors.LoginError('{0}: login failed'.format(request.status_code))
-        return request.status_code
 
     def login(self, remember_me=1):
         """This function is used to log in to a pod.
@@ -158,7 +157,7 @@ class Connection():
         self._login_data['user[remember_me]'] = remember_me
         status = self._login()
         self._login_data = {}
-        return status
+        return self
 
     def logout(self):
         """Logs out from a pod.