Ejemplo n.º 1
0
 def save(self, title):
     page = self.page_q.filter_by(title=title).first()
     if not page:
       page = Page(title)
     page.content = escape(request.POST.getone('content'))
     Session.add(page)
     Session.commit()
     flash('Successfully saved %s!' % title)
     redirect_to('show_page', title=title)
Ejemplo n.º 2
0
 def save(self, title):
     c.title = title
     page = self.page_q.filter_by(title=title).first()
     if not page:
         page = Page(title=title)
     # In a real application, you should validate and sanitize
     # submitted data throughly! escape is a minimal example here
     page.content = escape(request.POST.getone('content'))
     Session.add(page)
     Session.commit()
     flash('Successfully saved %s!' % title)
     redirect(url('show_page', title=title))
Ejemplo n.º 3
0
def setup_app(command, conf, vars):
    """Place any commands to setup {{package}} here"""
    # Don't reload the app if it was loaded under the testing environment
    if not pylons.test.pylonsapp:
        load_environment(conf.global_conf, conf.local_conf)
    
    # Create the tables if they don't already exist
    log.info("Creating tables...")
    Base.metadata.create_all(bind=Session.bind)
    log.info("Successfully set up.")
    
    log.info("Adding front page data...")
    page = model.Page(title=u'FrontPage',
                      content=u'**Welcome** to the QuickWiki front page!')
    Session.add(page)
    Session.commit()
    log.info("Successfully set up.")