def create(self): tag = model.Tag() for k, v in self.form_result.items(): setattr(tag, k, v) meta.Session.add(tag) meta.Session.commit() response.status_int = 302 response.headers['location'] = h.url_for(controller='tag', action='view', id=tag.id) return "Moved temporarily"
def create(self): page = model.Page() for k, v in self.form_result.items(): setattr(page, k, v) meta.Session.add(page) model.Nav.add_navigation_node(page, self.form_result['section'], self.form_result['before']) meta.Session.commit() response.status_int = 302 response.headers['location'] = h.url_for(controller='page', action='view', id=page.id) return "Moved temporarily"
def create(self): log.info("create comment") comment = model.Comment() for k, v in self.form_result.items(): log.info("%s,%s" % (k,v)) setattr(comment, k, v) comment.pageid = c.page.id meta.Session.add(comment) meta.Session.commit() response.status_int = 302 response.headers['location'] = h.url_for(pageid=c.page.id, controller='comment', action='view', id=comment.id) return "Moved temporarily"
def save(self, id=None): page_q = meta.Session.query(model.Comment) comment = page_q.filter_by(id=id).first() if comment is None: abort(404) for k,v in self.form_result.items(): if getattr(comment, k) != v: setattr(comment, k, v) meta.Session.commit() session['flash']='Comment successfully updated.' # Issue an HTTP redirect response.status_int = 302 response.headers['location'] = h.url_for(pageid=c.page.id, controller='comment', action='view', id=comment.id) return "Moved temporarily"
def create(self): section = model.Section() for k, v in self.form_result.items(): setattr(section, k, v) meta.Session.add(section) model.Nav.add_navigation_node(section, self.form_result['section'], self.form_result['before']) meta.Session.commit() index_page = model.page() index_page.title = 'Section Index' index_page.name = 'Section Index' index_page.path = 'index' index_page.content = 'This is the index page for this section' meta.Session.add(index_page) response.status_int = 302 response.headers['location'] = h.url_for(controller='section', action='view', id=section.id) return "Moved temporarily"
def save(self, id=None): page_q = meta.Session.query(model.Page) page = page_q.filter_by(id=id).first() if page is None: abort(404) if not (page.section == self.form_result['section'] and \ page.before == self.form_result['before']): model.Nav.remove_navigation_node(page) model.Nav.add_navigation_node(page, self.form_result['section'], self.form_result['before']) for k,v in self.form_result.items(): if getattr(page, k) != v: setattr(page, k, v) meta.Session.commit() session['flash']='Page successfully updated.' # Issue an HTTP redirect response.status_int = 302 response.headers['location'] = h.url_for(controller='page', action='view', id=page.id) return "Moved temporarily"
def signinagain(self): request.environ['paste.auth_tkt.logout_user']() return render('/derived/account/signin.html').replace('FORM_ACTION', h.url_for('signin'))