def view(self, id=None): if id is None: abort(404) tag_q = model.meta.Session.query(model.Tag) c.tag = tag_q.get(int(id)) if c.tag is None: abort(404) return render('/derived/tag/view.html')
def view(self, id=None): if id is None: abort(404) comment_q = model.meta.Session.query(model.Comment) c.comment = comment_q.filter_by(pageid=c.page.id, id=int(id)).first() if c.comment is None: abort(404) return render('/derived/comment/view.html')
def delete(self, id=None): if id is None: abort(404) section_q = meta.Session.query(model.Section) section = section_q.filter_by(id=id).first() if section is None: abort(404) nav_q = meta.Session.query(model.Nav) existing = nav_q.filter_by(section=id, type='section').filter(model.Page.path != 'index').first() if existing is not None: return render('/derived/section/cannot_delete.html') index_page = nav_q.filter_by(section=id, path='index', type='page').first() if index_page is not None: model.Nav.remove_navigation_node(index_page) meta.Session.delete(index_page) model.Nav.remove_navigation_node(section) meta.Session.delete(section) meta.Session.commit() return render('/derived/section/deleted.html')
def list(self): tag_q = meta.Session.query(model.Tag) c.paginator = paginate.Page( tag_q, page=int(request.params.get('page', 1)), items_per_page = 10, controller='tag', action='list' ) return render('/derived/tag/list.html')
def delete(self, id=None): if id is None: abort(404) comment_q = meta.Session.query(model.Comment) comment = comment_q.filter_by(pageid=c.page.id, id=id).first() if comment is None: abort(404) meta.Session.delete(comment) meta.Session.commit() return render('/derived/comment/deleted.html')
def delete(self, id=None): if id is None: abort(404) tag_q = meta.Session.query(model.Tag) tag = tag_q.filter_by(id=id).first() if tag is None: abort(404) meta.Session.execute(delete(model.pagetag_table, model.pagetag_table.c.tagid==tag.id)) meta.Session.delete(tag) meta.Session.commit() return render('/derived/tag/deleted.html')
def list(self): comments_q = meta.Session.query(model.Comment).filter_by(pageid=c.page.id) comments_q = comments_q.order_by(model.comment_table.c.created.asc()) c.paginator = paginate.Page( comments_q, page=int(request.params.get('page', 1)), items_per_page=10, pageid=c.page.id, controller='comment', action='list' ) return render('/derived/comment/list.html')
def edit(self, id=None): if id is None: abort(404) tag_q = meta.Session.query(model.Tag) tag = tag_q.filter_by(id=id).first() if tag is None: abort(404) values = { 'name': tag.name, } c.title = tag.title return htmlfill.render(render('/derived/tag/edit.html'), values)
def delete(self, id=None): if id is None: abort(404) page_q = meta.Session.query(model.Page) page = page_q.filter_by(id=id).first() if page is None: abort(404) meta.Session.execute(delete(model.pagetag_table, model.pagetag_table.c.pageid==page.id)) model.Nav.remove_navigation_node(page) meta.Session.delete(page) meta.Session.commit() return render('/derived/page/deleted.html')
def edit(self, id=None): if id is None: abort(404) comment_q = meta.Session.query(model.Comment) comment = comment_q.filter_by(pageid=c.page.id, id=id).first() if comment is None: abort(404) values = { 'name': comment.name, 'email': comment.email, 'content': comment.content, } c.title = comment.title return htmlfill.render(render('/derived/comment/edit.html'), values)
def edit(self, id=None): if id is None: abort(404) section_q = meta.Session.query(model.Section) section = section_q.filter_by(id=id).first() if section is None: abort(404) values = { 'name': section.name, 'path': section.path, 'section': section.section, 'before': section.before, } c.title = section.title return htmlfill.render(render('/derived/section/edit.html'), values)
def view(self, id=None): if id is None: abort(404) page_q = model.meta.Session.query(model.Page) c.page = page_q.get(int(id)) if c.page is None: abort(404) c.comment_count = meta.Session.query(model.Comment).filter_by(pageid=id).count() tag_q = meta.Session.query(model.Tag) c.available_tags = [(tag.id, tag.name) for tag in tag_q] c.selected_tags = {'tags':[str(tag.id) for tag in c.page.tags]} c.menu = request.environ['chezwam.navigation']['menu'] c.tabs = request.environ['chezwam.navigation']['tabs'] c.breadcrumbs = request.environ['chezwam.navigation']['breadcrumbs'] return render('/derived/page/view.html')
def edit(self, id=None): if id is None: abort(404) page_q = meta.Session.query(model.Page) page = page_q.filter_by(id=id).first() if page is None: abort(404) values = { 'name': page.name, 'path': page.path, 'section': page.section, 'before': page.before, 'title': page.title, 'heading': page.heading, 'content': page.content, } c.title = page.title return htmlfill.render(render('/derived/page/edit.html'), values)
def new(self): return render('/derived/tag/new.html')
def new(self): return render('/derived/comment/new.html')
def list(self): c.sections=meta.Session.query(model.Section).all() return render('/derived/section/list.html')
def view(self): return render('/derived/photostream/view.html');
def new(self): return render('/derived/page/new.html')
def nosection(self, section, path): return render('/derived/nav/create_section.html')
def list(self): c.pages=meta.Session.query(model.Page).all() return render('/derived/page/list.html')
def new(self): values = {} values.update(request.params) if values.has_key('before') and values['before'] == u'None': del values['before'] return htmlfill.render(render('/derived/section/new.html'), values)
def nopage(self, section, path): return render('/derived/nav/create_page.html')