Commits

kencochrane  committed 22fc90b

added status to post to let us know if it was sent to twitter or not, so we don't end up double posting

  • Participants
  • Parent commits 4435924

Comments (0)

Files changed (1)

     md5_hash = db.StringProperty(required=True)
     status = db.StringProperty(multiline=True)
     failed = db.BooleanProperty()
+    sent = db.BooleanProperty(default=False)
 
 # ------ URL Shortening Tool -----
 def bitly(url):
             bot = tweepy.API(auth)
         key = self.request.get('key')
         postie = PostDB.get(key)
-        if postie:
+        if postie and not postie.sent:
             try:
                 logging.info(postie.status)
                 if TWITTER_ENABLED:
                     bot.update_status(postie.status)
                 postie.failed = False
+                postie.sent = True
                 postie.put()
             except TweepError, e:
                 logging.error("error = %s" % e)
     """ If a post gets in an odd state this guy will find it, and attempt to fix it. """
     def get(self):
         query = PostDB.all()
-        query.filter('failed =',True)
+        query.filter('failed =',True).filter('sent =', False)
         results = query.fetch(50)
         for result in results:
             logging.info("Fix %s" % result)