From 75a456f4f8a970b697faae95fc33d5fead2f3e05 Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Fri, 12 Jul 2013 13:31:36 +0200 Subject: [PATCH] Some bug fixes and small changes --- Makefile | 5 +++++ diaspy/connection.py | 6 ++++-- diaspy/models.py | 5 ++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d2d66b2..40cdd45 100644 --- a/Makefile +++ b/Makefile @@ -14,3 +14,8 @@ clean: rm -rv diaspy/*.pyc rm -rv ./__pycache__/ rm -rv *.pyc + +install: + python setup.py install + rm -rvf dist/ + rm -rvf diaspy.egg-info diff --git a/diaspy/connection.py b/diaspy/connection.py index 28b5f8d..3c1a0be 100644 --- a/diaspy/connection.py +++ b/diaspy/connection.py @@ -39,9 +39,11 @@ class Connection(): self.login_data = {} self.token = '' try: self._setlogin(username, password) - except request.exceptions.MissingSchema: self.pod = '{0}://{1}'.format(schema, self.pod) + except requests.exceptions.MissingSchema: + self.pod = '{0}://{1}'.format(schema, self.pod) + warnings.warn('schema was missing') finally: pass - try: self._setlogin() + try: self._setlogin(username, password) except Exception as e: raise LoginError('cannot create login data (caused by: {0})'.format(e)) def __repr__(self): diff --git a/diaspy/models.py b/diaspy/models.py index 3cbe814..9e87f65 100644 --- a/diaspy/models.py +++ b/diaspy/models.py @@ -220,13 +220,12 @@ class Post(): def __repr__(self): """Returns string containing more information then str(). """ - data = self.get_data() - return '{0} ({1}): {2}'.format(data['author']['name'], data['author']['diaspora_id'], data['text']) + return '{0} ({1}): {2}'.format(self.data['author']['name'], self.data['author']['guid'], self.data['text']) def __str__(self): """Returns text of a post. """ - return self.get_data()['text'] + return self.data['text'] def _fetch(self): """This function retrieves data of the post. -- 2.25.1