Exemple #1
0
    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')
Exemple #2
0
    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')
Exemple #3
0
    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')
Exemple #4
0
 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')
Exemple #5
0
    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')	
Exemple #6
0
    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')	
Exemple #7
0
 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')
Exemple #8
0
    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)
Exemple #9
0
    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')	
Exemple #10
0
    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)
Exemple #11
0
    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)
Exemple #12
0
    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')
Exemple #13
0
    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)
Exemple #14
0
    def new(self):
		return render('/derived/tag/new.html')
Exemple #15
0
    def new(self):
		return render('/derived/comment/new.html')
Exemple #16
0
    def list(self):
		c.sections=meta.Session.query(model.Section).all()
		return render('/derived/section/list.html')
Exemple #17
0
 def view(self):
     return render('/derived/photostream/view.html');
Exemple #18
0
    def new(self):
		return render('/derived/page/new.html')
Exemple #19
0
    def nosection(self, section, path):
		return render('/derived/nav/create_section.html')
Exemple #20
0
    def list(self):
		c.pages=meta.Session.query(model.Page).all()
		return render('/derived/page/list.html')
Exemple #21
0
    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)
Exemple #22
0
    def nopage(self, section, path):
		return render('/derived/nav/create_page.html')