def get(self, event_id_string): # event... if self.deep_visible(): options = ( joinedload("eventtag_list"), ) else: options = ( joinedload("eventtag_list_public"), ) event = self._get_event(event_id_string, options=options) if self.deep_visible(): eventtag_list=event.eventtag_list else: eventtag_list=event.eventtag_list_public public = bool(self.current_user) eventtag_list = [eventtag.obj(public=public) for eventtag in eventtag_list] obj = event.obj( public=public, eventtag_obj_list=eventtag_list, ) # eventtag... eventtag_and_event_count_list, name, short, search = \ BaseEventtagHandler._get_eventtag_and_event_count_list_search_and_args(self) eventtag_list = [] for eventtag, event_count in eventtag_and_event_count_list: eventtag_list.append(eventtag.obj( public=bool(self.current_user), event_len=event_count, )) self.render( 'entity_tag.html', obj=obj, tag_list=eventtag_list, search=search, type_title="Event", type_title_plural="Events", type_url="event", type_tag_list="eventtag_list", type_entity_list="event_list", type_li_template="event_li", )
def get(self): is_json = self.content_type("application/json") name = self.get_argument("name", None, json=is_json) name_search = self.get_argument("name_search", None, json=is_json) past = self.get_argument_bool("past", None, json=is_json) tag_name_list = self.get_arguments("tag", json=is_json) offset = self.get_argument_int("offset", None, json=is_json) if self.deep_visible(): address_list_name = "address_list" else: address_list_name = "address_list_public" event_list, event_count, geobox, latlon = self._get_event_list_search( name=name, name_search=name_search, tag_name_list=tag_name_list, past=past, visibility=self.parameters["visibility"], address_list_name=address_list_name, offset=offset, ) if self.has_geo_arguments(): offset = None event_packet = { "event_list": [], "event_count": event_count, "geobox": geobox, "latlon": latlon, } if offset is not None: event_packet["offset"] = offset for event in event_list: if self.deep_visible(): address_list = event.address_list else: address_list = event.address_list_public address_list = [address.obj(public=bool(self.current_user)) \ for address in address_list] obj = event.obj( public=bool(self.current_user), address_obj_list=address_list, ) event_packet["event_list"].append(obj); if self.accept_type("json"): self.write_json(event_packet) else: full_eventtag_list = BaseEventtagHandler._get_full_eventtag_list(self) self.render( 'event_list.html', event_packet=event_packet, name_search=name_search, tag_name_list=tag_name_list, lookup=self.lookup, past=past, eventtag_list_json=json.dumps(full_eventtag_list), )