Exemplo n.º 1
0
 def setUp(self):
     self.scott = Account.new('scott', 'tiger', '*****@*****.**')
     self.scott_page = Page.new(self.scott, 'Book List')
     self.scott_rev = self.scott_page.save_draft_rev(
         'book list sample text', True)
     self.scott_page.publish_draft_rev()
     self.sally = Account.new('sally', 'secret', '*****@*****.**')
     self.sally_page = Page.new(self.sally, 'Dear Diary')
     self.sally_rev = self.sally_page.save_draft_rev('today i am sad', True)
     self.sally_page.publish_draft_rev()
Exemplo n.º 2
0
def handle_page_create(acct, title):

    # get form values
    page_text = request.form['text']
    use_markdown = request.form['use_markdown'] == 'True'
    private = request.form.has_key('private')

    # get button clicks
    publish = request.form.has_key('publish')
    save_draft = request.form.has_key('save_draft')
    cancel = request.form.has_key('cancel')

    if cancel:

        # TODO: redirect to requesting page
        return redirect_to_user_page(acct.uid, '__home')

    elif save_draft or publish:

        # create a new page
        page = Page.new(acct, title)
        page.private = private
        page.save_draft_rev(page_text, use_markdown)

        # persist
        if publish:
            page.publish_draft_rev()

        # redirect to view page
        return redirect_to_user_page(acct.uid, page.slug)
Exemplo n.º 3
0
 def test_new_reserved_name(self):
     page = Page.new(self.acct, 'Action')
     self.assertEqual('Action', page.title)
     self.assertEqual('action-1', page.slug)
Exemplo n.º 4
0
 def setUp(self):
     self.acct = Account.new('scott', 'tiger', '*****@*****.**')
     self.page = Page.new(self.acct, 'Book List')