Commits

David Chambers  committed 214ba10

fail silently on APIError: 13: You have exceeded your hourly limit of requests

  • Participants
  • Parent commits 9efa9da

Comments (0)

Files changed (2)

         title = self.title_text
 
         if self._thread_id is None:
-            self._thread_id = disqus.thread.id_from_identifier(identifier)
+            try:
+                self._thread_id = disqus.thread.id_from_identifier(identifier)
+            except disqus.APIError, error:
+                logger.warning('Disqus API error: %s' % error)
+                return
 
         if self._thread_id is not None:
             thread = cache.get(cache_key(self._thread_id))
     def comments(self):
         if mango.settings.DISQUS:
             thread = self._thread()
-            if thread:
+            if thread is not None:
                 return thread.posts
         return []
 
     if mango.settings.DISQUS:
         thread = document._thread()
 
-    comment = request.session.pop('comment', None) if thread else None
+    comment = thread and request.session.pop('comment', None)
     if comment is not None:
         comment = render_to_string('comment.html', {'comment': comment})