Merge branch 'master' into search
authorMarek Marecki <triviuss@gmail.com>
Sun, 7 Jul 2013 16:09:56 +0000 (18:09 +0200)
committerMarek Marecki <triviuss@gmail.com>
Sun, 7 Jul 2013 16:09:56 +0000 (18:09 +0200)
Conflicts:
diaspy/errors.py
diaspy/people.py

1  2 
diaspy/connection.py
diaspy/errors.py
diaspy/people.py
diaspy/streams.py

Simple merge
index 272e763d61189ff147360fc03889a44affa7e5a1,0620373964ddc5ebf28fb5877e3c505fb8efb995..35f1cf92c6ce9b782bea0051269f563b2f95f7a9
@@@ -22,7 -22,27 +22,33 @@@ class UserError(DiaspyError)
      pass
  
  
 +class SearchError(DiaspyError):
++    """Exception raised when something related to search goes wrong.
++    """
++    pass
++
++
+ class ConversationError(DiaspyError):
+     """Exception raised when something related to conversations goes wrong.
+     """
+     pass
+ class AspectError(DiaspyError):
+     """Exception raised when something related to aspects goes wrong.
+     """
+     pass
+ class PostError(DiaspyError):
+     """Exception raised when something related to posts goes wrong.
+     """
+     pass
+ class StreamError(DiaspyError):
+     """Exception raised when something related to streams goes wrong.
+     """
      pass
  
  
index f3d0048467e4a78f36cc9e4092fe3047e7c840df,c796569ddf2c7eba2a79e3d66cef3a8e7b128dfd..90f632512a54d00f2d8ae800c6fde14ad314f422
@@@ -25,9 -24,13 +25,11 @@@ class User()
      optional parameters. GUID takes precedence over handle when fetching
      user stream. When fetching user data, handle is required.
      """
 -    data = {}
 -    stream = []
 -
      def __init__(self, connection, guid='', handle='', fetch='posts', id=0):
          self._connection = connection
 +        self.stream = []
+         self.handle = handle
+         self.guid = guid
          self.data = {
              'guid': guid,
              'handle': handle,
      def fetchguid(self):
          """Fetch user data and posts using guid.
          """
-         request = self._connection.get('people/{0}.json'.format(self['guid']))
+         request = self._connection.get('people/{0}.json'.format(self.guid))
          self._postproc(request)
  
 -    def fetchprofile(self, protocol='https'):
 -        """Fetch user data using Diaspora handle.
 -        """
 -        request = self._connection.get('people.json?q={0}'.format(self['handle']))
 -        if request.status_code != 200:
 -            raise Exception('wrong error code: {0}'.format(request.status_code))
 -        else:
 -            request = request.json()
 -        if len(request):
 -            names = [('id', 'id'),
 -                     ('handle', 'diaspora_id'),
 -                     ('guid', 'guid'),
 -                     ('name', 'diaspora_name'),
 -                     ('avatar', 'image_urls'),
 -                     ]
 -            self.data = self._finalize_data(request[0], names)
 -
  
  class Contacts():
      """This class represents user's list of contacts.
Simple merge