From cd02dc71c77385a30ac4ccf29fb438bdc81f8d20 Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Mon, 26 Mar 2018 15:17:57 +0200 Subject: [PATCH] Deprecations --- diaspy/models.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/diaspy/models.py b/diaspy/models.py index e8396b3..64303e3 100644 --- a/diaspy/models.py +++ b/diaspy/models.py @@ -295,10 +295,14 @@ class Post(): return self._data['text'] def __getitem__(self, key): + """FIXME This is deprecated, use diaspy.models.Post.data() instead to access + data of Post objects. + """ return self._data[key] def __dict__(self): """Returns dictionary of posts data. + FIXME This is deprecated, use diaspy.models.Post.data() instead. """ return self._data @@ -331,10 +335,26 @@ class Post(): def update(self): """Updates post data. + FIXME This is deprecated. """ + print('diaspy.models.Post.update() is deprecated. Use diaspy.models.Post.update() instead.') self._fetchdata() self._fetchcomments() + def fetch(self, comments = False): + """Fetches post data. + Use this function instead of diaspy.models.Post.update(). + """ + self._fetchdata() + if comments: + self._fetchcomments() + return self + + def data(self, data = None): + if data is not None: + self._data = data + return self._data + def like(self): """This function likes a post. It abstracts the 'Like' functionality. -- 2.25.1