def welcome(cls, self, ar): #~ MAXITEMS = 2 u = ar.get_user() story = [] if u.profile.authenticated: intro = [_("Hi, %(user)s!") % dict(user=u.first_name)] story.append(E.p(*intro)) warnings = [] #~ for T in (MySuggestedCoachings,cal.MyTasksToDo): for table, text in settings.SITE.get_todo_tables(ar): if table.get_view_permission(u.profile): r = table.request(user=u) #~ r = T.request(subst_user=u) #~ r = ar.spawn(T) if r.get_total_count() != 0: warnings.append(E.li( ar.href_to_request(r, text % r.get_total_count()))) #~ _("You have %d entries in ") % r.get_total_count(), #~ ar.href_to_request(r,label))) #~ warnings.append(E.li("Test 1")) #~ warnings.append(E.li("Second test")) if len(warnings): #~ story.append(E.h3(_("Warnings"))) story.append(E.h3(_("You have"))) story.append(E.ul(*warnings)) else: story.append( E.p(_("Congratulatons: you have no warnings."))) #~ else: # story.append(E.p("Please log in")) #~ story.append(settings.SITE.get_guest_greeting()) return E.div(*story, class_="htmlText", style="margin:5px")
def render(sar): if sar.renderer is None: raise Exception("%s has no renderer", sar) if sar.get_total_count(): yield E.h3(sar.get_title()) yield sar