def get(self, lang, topic): print os.path.abspath(os.path.dirname(__file__)) print os.path.dirname(__file__) frame_template = common.GetTemplate('about/frame.html') blog_template = common.GetTemplate('about/%s/%s.html' % (lang, topic)) body = blog_template.render() frame = frame_template.render({'body': body, 'lang': lang}) self.response.write( common.WrapWithBaseTemplate(frame, lang, ['about', topic]))
def get(self, lang): base_template = common.GetTemplate('base.html') test_city_template = common.GetTemplate( '/cities/%s/test_city_tokyo.html' % lang) info_template = common.GetTemplate('cities/info_frame.html') tokyo_template = common.GetTemplate('cities/%s/tokyo.html' % lang) info = info_template.render({ 'description': tokyo_template.render(), 'meta': common.CITY_METAS['tokyo'], 'item_id': 'tokyo', }) body = test_city_template.render({'info': info, 'lang': lang}) self.response.write( common.WrapWithBaseTemplate(body, lang, ['test_city_tokyo']))
def get(self, lang, project_id, city_id): metas = common.CITY_METAS items = common.CITIES cities = ['tokyo'] cities.extend(common.CITIES) projects = common.PROJECTS is_multiple_pages = common.PROJECT_MATRIX_META[project_id][ 'is_multiple_pages'] project_matrix_meta = common.PROJECT_MATRIX_META[project_id] pages_meta = [] body = '' if is_multiple_pages and city_id in project_matrix_meta: pages_meta = project_matrix_meta[city_id] for page in pages_meta: content_template_path = 'matrix/%s/%s/%s_%s.html' % ( lang, city_id, project_id, page['id']) if common.existTemplate(content_template_path): body += common.GetTemplate(content_template_path).render( {'id': page['id']}) else: content_template_path = 'matrix/%s/%s/%s.html' % (lang, city_id, project_id) if common.existTemplate(content_template_path): body += common.GetTemplate(content_template_path).render() has_content = True if body is '': body = common.GetTemplate('coming_soon.html').render() has_content = False frame_template = common.GetTemplate('matrix/single_project_frame.html') frame = frame_template.render({ 'body': body, 'lang': lang, 'item_id': city_id, 'items': [metas[i] for i in items], 'is_multiple_pages': is_multiple_pages, 'pages_meta': pages_meta, 'has_content': has_content, 'city_id': city_id, 'project_id': project_id, }) self.response.write( common.WrapWithBaseTemplate(frame, lang, [project_id]))
def get(self, lang): now = datetime.datetime.now() date20150101 = datetime.datetime.fromtimestamp(1420090000) diff = (now.year * 12 + now.month) - (date20150101.year * 12 + date20150101.month) print now, date20150101 if diff > 11: diff = 11 if lang == 'en': label_key = 'label' else: label_key = 'label_ja' current_city_name = common.CITY_METAS[common.CITIES[diff]][label_key] top_template = common.GetTemplate('top.html') cities = ['tokyo'] cities.extend(common.CITIES) body = top_template.render({ 'cities': [common.CITY_METAS[c] for c in cities], 'lang': lang, 'current_city_name': current_city_name }) self.response.write(common.WrapWithBaseTemplate(body, lang, []))
def get(self, lang, typ, item): is_top = item != None if typ == 'cities': metas = common.CITY_METAS items = common.CITIES else: if lang == 'ja': metas = common.PROJECT_METAS_JA else: metas = common.PROJECT_METAS_EN items = common.PROJECTS if is_top: frame_template = common.GetTemplate('%s/frame.html' % typ) type_template = common.GetTemplate('%s/%s/%s.html' % (typ, lang, item)) info_template = common.GetTemplate('%s/info_frame.html' % typ) info_body = info_template.render({ 'description': type_template.render(), 'meta': metas[item], 'lang': lang, 'type': typ, 'item_id': item }) body = frame_template.render({ 'info': info_body, 'item_id': item, 'items': [metas[i] for i in items], 'lang': lang, }) dir_list = [typ, item] else: frame_template = common.GetTemplate('%s/frame.html' % typ) body = frame_template.render({ 'info': '', 'item_id': '', 'items': [metas[i] for i in items], 'lang': lang, 'is_top': True, }) dir_list = [typ] self.response.write(common.WrapWithBaseTemplate(body, lang, dir_list))
def get(self): self.response.write(common.GetTemplate('test/ad.html').render())
def get(self): base_template = common.GetTemplate('base.html') sponsors_template = common.GetTemplate('tac.html') sponsors_body = sponsors_template.render() self.response.write( common.WrapWithBaseTemplate(sponsors_body, 'en', ['tac']))
def get(self, lang): base_template = common.GetTemplate('base.html') template = common.GetTemplate('coming_soon.html') body = template.render() self.response.write( common.WrapWithBaseTemplate(body, lang, ['coming_soon']))
def get(self, lang): base_template = common.GetTemplate('base.html') sponsors_template = common.GetTemplate('sponsors_%s.html' % lang) sponsors_body = sponsors_template.render() self.response.write( common.WrapWithBaseTemplate(sponsors_body, lang, ['sponsors']))
def get(self, lang): people_template = common.GetTemplate('people_%s.html' % lang) people_body = people_template.render() self.response.write( common.WrapWithBaseTemplate(people_body, lang, ['people']))
def get(self, lang, city, project): cities = ['tokyo'] cities.extend(common.CITIES) projects = common.PROJECTS p_city_id = cities[cities.index(city) - 1] if cities.index(city) > 0 else '' c_city_id = city n_city_id = cities[cities.index(city) + 1] if cities.index(city) < len(cities) - 1 else '' p_project_id = projects[projects.index(project) - 1] if projects.index(project) > 0 else '' c_project_id = project n_project_id = projects[projects.index(project) + 1] if projects.index(project) < len(projects) - 1 else '' p_city_meta = common.CITY_METAS[p_city_id] if p_city_id else {} c_city_meta = common.CITY_METAS[c_city_id] if c_city_id else {} n_city_meta = common.CITY_METAS[n_city_id] if n_city_id else {} p_project_meta = common.PROJECT_METAS_EN[p_project_id] if p_project_id else {} c_project_meta = common.PROJECT_METAS_EN[c_project_id] if c_project_id else {} n_project_meta = common.PROJECT_METAS_EN[n_project_id] if n_project_id else {} is_multiple_pages = common.PROJECT_MATRIX_META[c_project_id][ 'is_multiple_pages'] project_matrix_meta = common.PROJECT_MATRIX_META[c_project_id] pages_meta = [] body = '' if is_multiple_pages and c_city_id in project_matrix_meta: pages_meta = project_matrix_meta[c_city_id] for page in pages_meta: content_template_path = 'matrix/%s/%s/%s_%s.html' % ( lang, c_city_id, c_project_id, page['id']) if common.existTemplate(content_template_path): body += common.GetTemplate(content_template_path).render({ 'id': page['id'] }) else: content_template_path = 'matrix/%s/%s/%s.html' % ( lang, c_city_id, c_project_id) if common.existTemplate(content_template_path): body += common.GetTemplate(content_template_path).render() # Creates grid data. _cities = [c for c in common.CITIES] _cities.append('tokyo') grid_data = {} for project in common.PROJECTS: project_data = {} for city in _cities: project_data[city] = False grid_data[project] = project_data for project in common.PROJECT_MATRIX_META: project_meta = common.PROJECT_MATRIX_META[project] for city in _cities: content_template_path = 'matrix/%s/%s/%s.html' % (lang, city, project) # Ignores other key like is_multiple_pages. if city in project_meta: grid_data[project][city] = True has_content = True if body is '': body = common.GetTemplate('coming_soon.html').render() has_content = False base_template = common.GetTemplate('base.html') frame_template = common.GetTemplate('matrix/frame.html') frame = frame_template.render({ 'body': body, 'lang': lang, 'p_city_meta': p_city_meta, 'c_city_meta': c_city_meta, 'n_city_meta': n_city_meta, 'p_project_meta': p_project_meta, 'c_project_meta': c_project_meta, 'n_project_meta': n_project_meta, 'is_multiple_pages': is_multiple_pages, 'pages_meta': pages_meta, 'has_content': has_content, 'grid_data': grid_data, 'cities': _cities, 'projects': common.PROJECTS, }) self.response.write(common.WrapWithBaseTemplate( frame, lang, ['project_matrix']))