changeset 1178:92ca86e417e3

pages (events): moved get interests code in prepare_render + use image as thumb_url if it does not already exist
author Goffi <goffi@goffi.org>
date Sat, 04 May 2019 00:01:08 +0200
parents 75c5e8d21c7d
children bfbfe04209e9
files libervia/pages/events/page_meta.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/pages/events/page_meta.py	Fri May 03 20:54:34 2019 +0200
+++ b/libervia/pages/events/page_meta.py	Sat May 04 00:01:08 2019 +0200
@@ -15,15 +15,16 @@
 
 
 @defer.inlineCallbacks
-def parse_url(self, request):
+def prepare_render(self, request):
     profile = self.getProfile(request)
     template_data = request.template_data
     template_data[u"url_event_new"] = self.getSubPageURL(request, "event_new")
     if profile is not None:
         try:
             events = yield self.host.bridgeCall("eventsList", "", "", profile)
-        except Exception:
-            log.warning(_(u"Can't get events list for {profile}").format(profile=profile))
+        except Exception as e:
+            log.warning(_(u"Can't get events list for {profile}: {reason}").format(
+                profile=profile, reason=e))
         else:
             own_events = []
             other_events = []
@@ -46,5 +47,7 @@
                         event.get("node", ""),
                         event.get("item"),
                     )
+                if u"thumb_url" not in event and u"image" in event:
+                    event[u"thumb_url"] = event[u"image"]
 
             template_data[u"events"] = own_events + other_events