Commits

hoop committed d539562

Don't crash on empty recommendation set

  • Participants
  • Parent commits b8c57f3

Comments (0)

Files changed (1)

widgets/recommendations.py

 
 class Recommendations(tornado.web.UIModule):
     def render(self):
-        recs = self.handler.db.profiles.find_one(self.handler.session['_id'])['recs']
-        return self.render_string('widgets/recs.html',recs=recs)
+        profile = self.handler.db.profiles.find_one(self.handler.session['_id'])
+        if profile:
+            recs = profile['recs']
+            return self.render_string('widgets/recs.html',recs=recs)
+        else:
+            return ''