Esempio n. 1
0
 def extract_thumbnail(self):
     """
     ideally this type of heavy content fetching should be put on a
     celery background task manager or at least a crontab.. instead of
     setting it to run literally as someone posts a thread. but once again,
     this repo is just a simple example of a reddit-like crud application!
     """
     DEFAULT_THUMBNAIL = 'http://reddit.codelucas.com/static/imgs/reddit-camera.png'
     if self.link:
         thumbnail = media.get_top_img(self.link)
     if not thumbnail:
         thumbnail = DEFAULT_THUMBNAIL
     self.thumbnail = thumbnail
     db.session.commit()
Esempio n. 2
0
 def extract_thumbnail(self):
     """
     ideally this type of heavy content fetching should be put on a
     celery background task manager or at least a crontab.. instead of
     setting it to run literally as someone posts a thread. but once again,
     this repo is just a simple example of a reddit-like crud application!
     """
     DEFAULT_THUMBNAIL = 'https://reddit.codelucas.com/static/imgs/reddit-camera.png'
     if self.link:
         thumbnail = media.get_top_img(self.link)
     if not thumbnail:
         thumbnail = DEFAULT_THUMBNAIL
     self.thumbnail = thumbnail
     db.session.commit()