def GET(self): template_values = { 'site_info': self.site_info } path = os.path.join(os.path.dirname(__file__), 'tpl', 'shared') web.header('Content-Type', 'text/plain; charset=UTF-8') return template_render('robots.txt', path, template_values)
def GET(self): template_values = { 'site_info': self.site_info, 'posts': reader.get_all() } path = os.path.join(os.path.dirname(__file__), 'tpl', 'writer') return template_render('overview.html', path, template_values)
def GET(self): template_values = { 'site_info': self.site_info, 'posts': reader.get_all_posts() } path = os.path.join(os.path.dirname(__file__), 'tpl', 'shared') web.header('Content-Type', 'text/xml; charset=UTF-8') return template_render('feed.xml', path, template_values)
def GET(self): template_values = { 'posts': reader.get_all_posts(), 'pages': reader.get_all_pages(), 'site_info': self.site_info } path = os.path.join(os.path.dirname(__file__), 'tpl', 'post') return template_render('posts.html', path, template_values)
def GET(self): template_values = { 'site_info': self.site_info, 'mode': 'edit', 'post': reader.get_index() } path = os.path.join(os.path.dirname(__file__), 'tpl', 'writer') return template_render('index_write.html', path, template_values)
def GET(self): template_values = { 'site_info': self.site_info, 'feed_url': '/feed.xml', 'site_updated': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), 'posts': reader.get_last_modified(), 'post_count': len(reader.get_last_modified()) } web.header('Content-Type', 'text/xml; charset=UTF-8') path = os.path.join(os.path.dirname(__file__), 'tpl', 'shared') return template_render('sitemap.xml', path, template_values)
def GET(self, url): post = reader.get_post_by_url(url) if post: template_values = { 'post': post, 'site_info': self.site_info, 'pages': reader.get_all_pages() } path = os.path.join(os.path.dirname(__file__), 'tpl', 'post') return template_render('post.html', path, template_values) else: raise web.notfound()
def GET(self, id=''): template_values = { 'site_info': self.site_info } path = os.path.join(os.path.dirname(__file__), 'tpl', 'writer') if (id): template_values['mode'] = 'edit' template_values['post'] = reader.get_post_by_id(id) else: template_values['mode'] = 'new' template_values['post'] = post() return template_render('write.html', path, template_values)
def GET(self): site_info = reader.get_site_setting() if site_info == None: site_info = site_setting() site_info.site_name = 'demo' site_info.site_slogan = '' site_info.author = 'chimchar' site_info.google_analytic_id = '' writer.set_site_setting(site_info) site_info.site_domain = web.ctx.host template_values = { 'site_info': site_info } path = os.path.join(os.path.dirname(__file__), 'tpl', 'writer') return template_render('auth.html', path, template_values)
def POST(self): site_info = reader.get_site_setting() if site_info == None: site_info = site_setting() site_info.site_name = 'demo' site_info.site_slogan = '' site_info.author = 'chimchar' site_info.google_analytic_id = '' writer.set_site_setting(site_info) site_info.site_domain = web.ctx.host template_values = { 'site_info': site_info } path = os.path.join(os.path.dirname(__file__), 'tpl', 'writer') pwd = web.input().passwd sha1 = hashlib.sha1(pwd).hexdigest() if (sha1 == SECRET): web.setcookie('is_pass', sha1, 3600) web.redirect('/overview') else: template_values['message'] = 'Secret pharse WRONG!' return template_render('auth.html', path, template_values)
def GET(self): template_values = { 'site_info': self.site_info } path = os.path.join(os.path.dirname(__file__), 'tpl', 'writer') return template_render('settings.html', path, template_values)