def get_changes(self, user, head): restype = get_restype(self.request) rendered = None if restype == 'default': if rendered is None: pages = WikiPage.get_changes(user) rendered = template(self.request, 'wiki_sp_changes.html', {'pages': pages}) self.response.headers['Content-Type'] = 'text/html; charset=utf-8' set_response_body(self.response, rendered, head) elif restype == 'atom': if rendered is None: pages = WikiPage.get_changes(None, 3, include_body=True) config = WikiPage.get_config() host = self.request.host_url url = "%s/sp.changes?_type=atom" % host feed = AtomFeed(title="%s: changes" % config['service']['title'], feed_url=url, url="%s/" % host, author=config['admin']['email']) for page in pages: feed.add(title=page.title, content_type="html", content=page.rendered_body, author=page.modifier, url='%s%s' % (host, page.absolute_url), updated=page.updated_at) rendered = feed.to_string() self.response.headers['Content-Type'] = 'text/xml; charset=utf-8' set_response_body(self.response, rendered, head) else: self.abort(400, 'Unknown type: %s' % restype)
def test_normal_links(self): page_a = WikiPage.get_by_title(u'A') page_a.update_content(u'[[B]]', 0) page_b = WikiPage.get_by_title(u'B') self.assertEqual([u'A'], page_b.data['inlinks']) self.assertEqual([u'B'], page_a.data['outlinks'])
def test_delete_published_page(self): self.login('*****@*****.**', 'a', is_admin=True) WikiPage.get_by_title(u'Hello 2').delete(self.get_cur_user()) newer, older = WikiPage.get_posts_of(None, 20) self.assertEqual(u'Hello 3', older.newer_title) self.assertEqual(u'Hello 1', newer.older_title)
def get(self, path, head=False): cache.create_prc() query = WikiPage.path_to_title(path) user = get_cur_user() result = WikiPage.wikiquery(query, user) view = self.request.GET.get('view', 'default') restype = get_restype(self.request) if restype == 'default' or restype == 'html': if view == 'bodyonly': html = template(self.request, 'bodyonly.html', { 'title': u'Search: %s ' % query, 'body': obj_to_html(result), }) else: html = template(self.request, 'wikiquery.html', { 'query': query, 'result': obj_to_html(result), }) self.response.headers['Content-Type'] = 'text/html; charset=utf-8' set_response_body(self.response, html, head) elif restype == 'json': self.response.headers[ 'Content-Type'] = 'application/json; charset=utf-8' set_response_body(self.response, json.dumps(result), head) else: self.abort(400, 'Unknown type: %s' % restype)
def test_logical_operations(self): self.assertEqual([{u'name': u'The Mind\'s I'}, {u'name': u'GEB'}], WikiPage.wikiquery(u'"GEB" + "The Mind\'s I"')) self.assertEqual({u'name': u'The Mind\'s I'}, WikiPage.wikiquery(u'schema:"Book" * author:"Douglas Hofstadter" * author:"Daniel Dennett"')) self.assertEqual([{'name': u"The Mind's I"}, {'name': u'GEB'}], WikiPage.wikiquery(u'schema:"Book" + author:"Douglas Hofstadter" * author:"Daniel Dennett"'))
def get_index(self, user, head): restype = get_restype(self.request) if restype == 'default': pages = WikiPage.get_index(user) page_group = groupby(pages, lambda p: title_grouper(p.title)) html = template(self.request, 'wiki_sp_index.html', {'page_group': page_group}) self.response.headers['Content-Type'] = 'text/html; charset=utf-8' set_response_body(self.response, html, head) elif restype == 'atom': pages = WikiPage.get_index(None) config = WikiPage.get_config() host = self.request.host_url url = "%s/sp.index?_type=atom" % host feed = AtomFeed(title="%s: title index" % config['service']['title'], feed_url=url, url="%s/" % host, author=config['admin']['email']) for page in pages: feed.add(title=page.title, content_type="html", author=page.modifier, url='%s%s' % (host, page.absolute_url), updated=page.updated_at) self.response.headers['Content-Type'] = 'text/xml; charset=utf-8' set_response_body(self.response, feed.to_string(), head) else: self.abort(400, 'Unknown type: %s' % restype)
def get(self, path, head=False): cache.create_prc() query = WikiPage.path_to_title(path) user = get_cur_user() result = WikiPage.wikiquery(query, user) view = self.request.GET.get('view', 'default') restype = get_restype(self.request) if restype == 'default' or restype == 'html': if view == 'bodyonly': html = template(self.request, 'bodyonly.html', { 'title': u'Search: %s ' % query, 'body': obj_to_html(result), }) else: html = template(self.request, 'wikiquery.html', { 'query': query, 'result': obj_to_html(result), }) self.response.headers['Content-Type'] = 'text/html; charset=utf-8' set_response_body(self.response, html, head) elif restype == 'json': self.response.headers['Content-Type'] = 'application/json; charset=utf-8' set_response_body(self.response, json.dumps(result), head) else: self.abort(400, 'Unknown type: %s' % restype)
def get(self, path, head=False): cache.create_prc() expression = WikiPage.path_to_title(path) parsed_expression = search.parse_expression(expression) scoretable = WikiPage.search(expression) positives = dict([(k, v) for k, v in scoretable.items() if v >= 0.0]) positives = OrderedDict( sorted(positives.iteritems(), key=operator.itemgetter(1), reverse=True)[:20]) negatives = dict([(k, abs(v)) for k, v in scoretable.items() if v < 0.0]) negatives = OrderedDict( sorted(negatives.iteritems(), key=operator.itemgetter(1), reverse=True)[:20]) self.response.headers['Content-Type'] = 'text/html; charset=utf-8' html = template( self.request, 'search.html', { 'expression': expression, 'parsed_expression': parsed_expression, 'positives': positives, 'negatives': negatives }) set_response_body(self.response, html, head)
def test_normal_links(self): page_a = WikiPage.get_by_title(u"A") page_a.update_content(u"[[B]]", 0) page_b = WikiPage.get_by_title(u"B") self.assertEqual([u"A"], page_b.data["inlinks"]) self.assertEqual([u"B"], page_a.data["outlinks"])
def test_delete_published_page(self): self.login('*****@*****.**', 'a', is_admin=True) WikiPage.get_by_title(u'Hello 2').delete(self.get_cur_user()) newer, older = WikiPage.get_posts_of(None) self.assertEqual(u'Hello 3', older.newer_title) self.assertEqual(u'Hello 1', newer.older_title)
def test_no_links(self): a = WikiPage.get_by_title(u'A') a.update_content(u'Hello', 0) a = WikiPage.get_by_title(u'A') self.assertEqual({}, a.inlinks) self.assertEqual({}, a.outlinks)
def get_sp_index(self, user, head): restype = self._get_restype() if restype == "default": pages = WikiPage.get_index(user) page_group = groupby(pages, lambda p: title_grouper(p.title)) html = self._template("wiki_sp_index.html", {"page_group": page_group}) self.response.headers["Content-Type"] = "text/html; charset=utf-8" self._set_response_body(html, head) elif restype == "atom": pages = WikiPage.get_index(None) config = WikiPage.yaml_by_title(".config") host = self.request.host_url url = "%s/sp.index?_type=atom" % host feed = AtomFeed( title="%s: title index" % config["service"]["title"], feed_url=url, url="%s/" % host, author=config["admin"]["email"], ) for page in pages: feed.add( title=page.title, content_type="html", author=page.modifier, url="%s%s" % (host, page.absolute_url), updated=page.updated_at, ) self.response.headers["Content-Type"] = "text/xml; charset=utf-8" self._set_response_body(feed.to_string(), head) else: self.abort(400, "Unknown type: %s" % restype)
def test_no_links(self): a = WikiPage.get_by_title(u"A") a.update_content(u"Hello", 0, "") a = WikiPage.get_by_title(u"A") self.assertEqual({}, a.inlinks) self.assertEqual({}, a.outlinks)
def wiki_page_edit(request, page_path, _page_obj=None): page = _page_obj or WikiPage.get_object_by_path(page_path) preview_action = request.POST and 'preview' in request.POST if request.POST: form = WikiPageForm(data=request.POST, initial={'author':request.user}, instance=page) if form.is_valid(): page = form.save(commit=False) if not preview_action: pages = WikiPage.make_path(page_path, kwargs={'author':request.user}) if pages: page.parent_page = pages[-1] page.title = WikiPage.get_title_from_path(page_path) print page_path print page.title page.author = request.user page.save() return redirect('wiki_page', page_path=page_path) else: form = WikiPageForm(initial={'author':request.user}, instance=page) context = {} context['page'] = page context['page_path'] = page_path context['form'] = form context['preview_action'] = preview_action return context
def _edit(request, page): # Have to do special stuff with handling the app home URN index if page == None: page = 'index' # Check if user is signed in, if not, go back to the app index name = signed_in(request) if not name: return redirect('final_wiki', page='') # Is this post? if request.method == "POST": # Grab post info form = SubmitForm(request.POST) content = form.data['content'] if form.is_valid(): # If this wikipage doesn't exist, create new and save if not WikiPage.objects.filter(page_url=page).exists(): m = WikiPage(page_url=page) m.save() # If it does, grab it so we can update this page's history else: m = WikiPage.objects.get(page_url=page) # Update this pages wikihistory! n = WikiPageHistory(page=m, content=content) n.save() # Redirect back to the new page (handle index URN) if page == 'index': page = '' return redirect('final_wiki', page=page) # No post, so present the form to edit a wikipage else: # Create wikipage form form = SubmitForm(request.POST) # Show the values for the current page in the wikipage form if WikiPage.objects.filter(page_url=page).exists(): i = WikiPage.objects.get(page_url=page) j = return_wikipagehistory(i, request.GET.get('v')) # If there is no page history, make sure the index (/) is referred to as (index) if not j: if page == "index": page = '' return redirect('final__edit', page=page) # Where we pass the form content to the _edit view content = j.content else: # Just pass blank content to the form, this is a new page content = "" # Pass along stuff and render d=dict(content=content, page=page, name=name) return render_to_response("7_final/edit.html", d, context_instance=RequestContext(request))
def test_specifying_attr(self): result = WikiPage.wikiquery(u'"GEB" > author') self.assertEqual(u'Douglas Hofstadter', result['author'].pvalue) result = WikiPage.wikiquery(u'"GEB" > name, author, datePublished') self.assertEqual(u'Douglas Hofstadter', result['author'].pvalue) self.assertEqual(u'GEB', result['name'].pvalue) self.assertEqual(u'1979', result['datePublished'].pvalue)
def post(self, title, content): page = self.load_page(title) if not page: page = WikiPage(title=title) page.save() self.put(title, content)
def test_first_publish(self): self.update_page(u'Hello', u'Hello') self.assertEqual(0, len(WikiPage.get_posts_of(None))) page = self.update_page(u'.pub\nHello', u'Hello') self.assertIsNotNone(page.published_at) self.assertIsNone(page.published_to) self.assertEqual(1, len(WikiPage.get_posts_of(None)))
def post(self, page_name): opts = json.loads(self.request.body) page = WikiPage(title=page_name) version = WikiPageVersion(text=opts.get('content', [])) version.save() page.versions.append(version) page.save() self.set_status(201)
def test_unpublish_newest(self): newest = WikiPage.get_by_title(u'Hello 3') newest.update_content(u'Hello 3', 1) newer, older = WikiPage.get_published_posts(None, 20) self.assertEqual(u'Hello 2', older.newer_title) self.assertEqual(u'Hello 1', newer.older_title)
def test_specifying_attr_order(self): result = WikiPage.wikiquery(u'schema:"Book" > author, datePublished+') self.assertEqual(u'1979', result[0]['datePublished'].pvalue) self.assertEqual(u'1982', result[1]['datePublished'].pvalue) result = WikiPage.wikiquery(u'schema:"Book" > author, datePublished-') self.assertEqual(u'1982', result[0]['datePublished'].pvalue) self.assertEqual(u'1979', result[1]['datePublished'].pvalue)
def test_first_publish(self): self.update_page(u'Hello', u'Hello') self.assertEqual(0, len(WikiPage.get_posts_of(None, 20))) page = self.update_page(u'.pub\nHello', u'Hello') self.assertIsNotNone(page.published_at) self.assertIsNone(page.published_to) self.assertEqual(1, len(WikiPage.get_posts_of(None, 20)))
def test_years_section(self): page = WikiPage.get_by_title(u"2") ss = page.special_sections[u"years"] self.assertEqual([u"2 BCE", u"1 BCE", u"1", u"2", u"3", u"4", u"5"], ss[u"years"]) page = WikiPage.get_by_title(u"2 BCE") ss = page.special_sections[u"years"] self.assertEqual([u"5 BCE", u"4 BCE", u"3 BCE", u"2 BCE", u"1 BCE", u"1", u"2"], ss[u"years"])
def test_empty_config_page(self): config_page = WikiPage.get_by_title('.config') config_page.update_content('', 1, user=self.get_cur_user()) config = WikiPage.get_config() perm = config['service']['default_permissions'] self.assertEqual(perm['read'], ['all']) self.assertEqual(perm['write'], ['login'])
def test_unpublish_newest(self): newest = WikiPage.get_by_title(u'Hello 3') newest.update_content(u'Hello 3', 1, '') newer, older = WikiPage.get_published_posts(None, 20) self.assertEqual(u'Hello 2', older.newer_title) self.assertEqual(u'Hello 1', newer.older_title)
def test_compare_yaml_and_embedded_data(self): page1 = WikiPage.get_by_title(u'A') page1.update_content(u'.schema Book\n #!yaml/schema\n datePublished: "1979-03-01"\n', 0) page2 = WikiPage.get_by_title(u'B') page2.update_content(u'.schema Book\n\n[[datePublished::1979-03-01]]', 0) self.assertEqual(page1.data['datePublished'], page2.data['datePublished']) self.assertEqual(page1.outlinks, page2.outlinks)
def test_remove_schema(self): self.update_page(u'.schema Code\n[[1979]]', u'A') self.update_page(u'[[1979]]', u'A') page = WikiPage.get_by_title(u'A') year = WikiPage.get_by_title(u'1979') self.assertEqual({u'Article/relatedTo': [u'1979']}, page.outlinks) self.assertEqual({u'Article/relatedTo': [u'A']}, year.inlinks)
def test_delete(self): self.login('*****@*****.**', 'ak', is_admin=True) memo = self.update_page(u'Hello', u'GEB/Chapter 1/Memo') memo.delete(self.get_cur_user()) self.assertEqual({}, WikiPage.get_by_title(u'GEB').inlinks) self.assertEqual({}, WikiPage.get_by_title(u'GEB/Chapter 1').inlinks)
def test_empty_config_page(self): config_page = WikiPage.get_by_title(u'.config') config_page.update_content('', 1) config = WikiPage.get_config() perm = config['service']['default_permissions'] self.assertEqual(perm['read'], ['all']) self.assertEqual(perm['write'], ['login'])
def test_add_schema(self): self.update_page(u'[[1979]]', u'A') self.update_page(u'.schema Book\n[[1979]]', u'A') page = WikiPage.get_by_title(u'A') year = WikiPage.get_by_title(u'1979') self.assertEqual({u'Book/relatedTo': [u'1979']}, page.outlinks) self.assertEqual({u'Book/relatedTo': [u'A']}, year.inlinks)
def test_update_rel(self): self.update_page(u'[[1979]]', u'A') self.update_page(u'.schema Person\n[[birthDate::1979]]', u'A') page = WikiPage.get_by_title(u'A') year = WikiPage.get_by_title(u'1979') self.assertEqual({u'Person/birthDate': [u'1979']}, page.outlinks) self.assertEqual({u'Person/birthDate': [u'A']}, year.inlinks)
def test_two_aliases(self): self.update_page(u'.redirect C', u'B') self.update_page(u'[[C]]', u'A') self.update_page(u'[[B]]', u'A') a = WikiPage.get_by_title(u'A') c = WikiPage.get_by_title(u'C') self.assertEqual({u'Article/relatedTo': [u'A']}, c.inlinks) self.assertEqual({u'Article/relatedTo': [u'C']}, a.outlinks)
def test_link_in_yaml_schema_block(self): page = WikiPage.get_by_title(u'A') page.update_content(u'.schema Book\n #!yaml/schema\n author: Richard Dawkins\n', 0) page = WikiPage.get_by_title(u'A') self.assertEqual({u'Book/author': [u'Richard Dawkins']}, page.outlinks) rd = WikiPage.get_by_title(u'Richard Dawkins') self.assertEqual({u'Book/author': [u'A']}, rd.inlinks)
def test_first_publish(self): page = WikiPage.get_by_title(u'Hello') page.update_content(u'Hello', 0, '') self.assertEqual(0, len(WikiPage.get_published_posts(None, 20))) page.update_content(u'.pub\nHello', 1, '') self.assertIsNotNone(page.published_at) self.assertIsNone(page.published_to) self.assertEqual(1, len(WikiPage.get_published_posts(None, 20)))
def test_normal_pages(self): for title, _ in self.fixtures: self._validate('/%s' % WikiPage.title_to_path(title), 'html') self._validate('/%s?rev=1' % WikiPage.title_to_path(title), 'html') self._validate('/%s?_type=body' % WikiPage.title_to_path(title), 'html') self._validate('/%s?_type=form' % WikiPage.title_to_path(title), 'html')
def test_older_newer_isolation(self): b1p1 = WikiPage.get_by_title(u'b1p1') b1p2 = WikiPage.get_by_title(u'b1p2') b2p1 = WikiPage.get_by_title(u'b2p1') b2p2 = WikiPage.get_by_title(u'b2p2') self.assertEqual('b1p2', b1p1.newer_title) self.assertEqual('b1p1', b1p2.older_title) self.assertEqual('b2p2', b2p1.newer_title) self.assertEqual('b2p1', b2p2.older_title)
def test_first_publish(self): page = WikiPage.get_by_title(u'Hello') page.update_content(u'Hello', 0) self.assertEqual(0, len(WikiPage.get_published_posts(None, 20))) page.update_content(u'.pub\nHello', 1) self.assertIsNotNone(page.published_at) self.assertIsNone(page.published_to) self.assertEqual(1, len(WikiPage.get_published_posts(None, 20)))
def setUp(self): super(WikiPageDeleteTest, self).setUp() self.login('*****@*****.**', 'a') self.update_page(u'Hello [[B]]', u'A') self.update_page(u'Hello [[A]]', u'B') # reload self.pagea = WikiPage.get_by_title(u'A') self.pageb = WikiPage.get_by_title(u'B')
def test_years_section(self): page = WikiPage.get_by_title(u'2') ss = page.special_sections[u'years'] self.assertEqual([u'2 BCE', u'1 BCE', u'1', u'2', u'3', u'4', u'5'], ss[u'years']) page = WikiPage.get_by_title(u'2 BCE') ss = page.special_sections[u'years'] self.assertEqual( [u'5 BCE', u'4 BCE', u'3 BCE', u'2 BCE', u'1 BCE', u'1', u'2'], ss[u'years'])
def test_adding_redirect_should_change_inout_links(self): self.update_page(u'[[B]]', u'A') self.update_page(u'.redirect C', u'B') a = WikiPage.get_by_title(u'A') b = WikiPage.get_by_title(u'B') c = WikiPage.get_by_title(u'C') self.assertEqual({u'Article/relatedTo': [u'C']}, a.outlinks) self.assertEqual({}, b.inlinks) self.assertEqual({}, b.outlinks) self.assertEqual({u'Article/relatedTo': [u'A']}, c.inlinks)
def put(self, path): cache.create_prc() title = WikiPage.path_to_title(path) user = get_cur_user() page = WikiPage.get_by_title(title) revision = int(self.request.POST['revision']) new_body = self.request.POST['body'] comment = self.request.POST.get('comment', '') preview = self.request.POST.get('preview', '0') if preview == '1': self.response.headers['Content-Type'] = 'text/html; charset=utf-8' html = template(self.request, 'bodyonly.html', { 'title': page.title, 'body': page.preview_rendered_body(new_body) }) set_response_body(self.response, html, False) return if not page.can_write(user): self.response.status = 403 self.response.headers['Content-Type'] = 'text/html; charset=utf-8' html = template(self.request, '403.html', {'page': page}) set_response_body(self.response, html, False) return try: page.update_content(new_body, revision, comment, user) self.response.location = page.absolute_url self.response.headers['X-Message'] = 'Successfully updated.' quoted_path = urllib2.quote(path.replace(' ', '_')) restype = get_restype(self.request) self.response.headers['Location'] = str('/' + quoted_path) if restype != 'default': self.response.headers['Location'] += str('?_type=%s' % restype) self.response.status = 303 except ConflictError as e: self.response.status = 409 self.response.headers['Content-Type'] = 'text/html; charset=utf-8' html = template(self.request, 'wikipage.form.html', { 'page': page, 'conflict': e }) set_response_body(self.response, html, False) except ValueError as e: self.response.status = 406 self.response.headers['Content-Type'] = 'text/html; charset=utf-8' html = template(self.request, 'error_with_messages.html', { 'page': page, 'errors': [e.message] }) set_response_body(self.response, html, False)
def namespace(request, namespace): ns = get_object_or_404(Namespace, owner=request.user, name=namespace) page = WikiPage.objects.get_or_create(namespace=ns, name='SplashPage')[0] if request.method == 'POST' and ns.can_update(request.user): create_wiki_page_form = CreateWikiPageForm(request.POST, instance=WikiPage(namespace=ns)) if create_wiki_page_form.is_valid() and WikiPage.objects.filter(namespace=ns, name=create_wiki_page_form.cleaned_data['name']).count() == 0: page = create_wiki_page_form.save() return HttpResponseRedirect(reverse('peach.mobile_views.wiki', kwargs={'namespace':namespace, 'name':page.name})) else: create_wiki_page_form = CreateWikiPageForm(instance=WikiPage(namespace=ns)) if not ns.can_read(request.user): return HttpResponseRedirect(reverse('peach.mobile_views.index')) return render_to_response('peach/mobile/namespace.html', { 'namespace':ns, 'page':page, 'create_wiki_page_form':create_wiki_page_form, 'wiki_pages':WikiPage.objects.filter(namespace=ns).exclude(name='SplashPage') }, context_instance=RequestContext(request))
def test_second_publish(self): page1 = WikiPage.get_by_title(u'Hello 1') page1.update_content(u'.pub\nHello 1', 0) page2 = WikiPage.get_by_title(u'Hello 2') page2.update_content(u'.pub\nHello 2', 0) posts = WikiPage.get_published_posts(None, 20) self.assertEqual(2, len(posts)) self.assertEqual(page2.title, posts[1].newer_title) self.assertEqual(page1.title, posts[0].older_title)
def setUp(self): self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_datastore_v3_stub() self.testbed.init_memcache_stub() self.testbed.init_taskqueue_stub() self.testbed.init_user_stub() cache.prc.flush_all() WikiPage.get_by_title(u'A').update_content(u'.schema Book\n.read all\nHello', 0, u'') WikiPage.get_by_title(u'B').update_content(u'.schema Book\n.read [email protected]\nThere', 0, u'') for p in WikiPage.query().fetch(): p.rebuild_data_index()
def test_multiple_custom_blogs(self): self.update_page(u'.pub B1', u'b1p1') self.update_page(u'.pub B1', u'b1p2') self.update_page(u'.pub B2', u'b2p1') self.update_page(u'.pub B2', u'b2p2') b1p1 = WikiPage.get_by_title(u'b1p1') b1p2 = WikiPage.get_by_title(u'b1p2') b2p1 = WikiPage.get_by_title(u'b2p1') b2p2 = WikiPage.get_by_title(u'b2p2') self.assertEqual('b1p2', b1p1.newer_title) self.assertEqual('b1p1', b1p2.older_title) self.assertEqual('b2p2', b2p1.newer_title) self.assertEqual('b2p1', b2p2.older_title)
def test_delete_and_redirection_1(self): self.update_page(u'.redirect C', u'B') self.update_page(u'Hello [[A]]', u'C') self.login('*****@*****.**', 'a', is_admin=True) WikiPage.get_by_title(u'A').delete(users.get_current_user()) self.pagea = WikiPage.get_by_title(u'A') self.pagec = WikiPage.get_by_title(u'C') self.assertEqual(1, len(self.pagea.inlinks)) self.assertEqual(0, len(self.pagea.outlinks)) self.assertEqual(0, len(self.pagec.inlinks)) self.assertEqual(1, len(self.pagec.outlinks))
def setUp(self): self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_datastore_v3_stub() self.testbed.init_memcache_stub() self.testbed.init_taskqueue_stub() self.b1p1 = WikiPage.get_by_title(u'b1p1') self.b1p1.update_content(u'.pub B1', 0) self.b2p1 = WikiPage.get_by_title(u'b2p1') self.b2p1.update_content(u'.pub B2', 0) self.b1p2 = WikiPage.get_by_title(u'b1p2') self.b1p2.update_content(u'.pub B1', 0) self.b2p2 = WikiPage.get_by_title(u'b2p2') self.b2p2.update_content(u'.pub B2', 0)
def setUp(self): self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_datastore_v3_stub() self.testbed.init_memcache_stub() self.testbed.init_taskqueue_stub() page1 = WikiPage.get_by_title(u'Hello 1') page1.update_content(u'.pub\nHello 1', 0) page2 = WikiPage.get_by_title(u'Hello 2') page2.update_content(u'.pub\nHello 2', 0) page3 = WikiPage.get_by_title(u'Hello 3') page3.update_content(u'.pub\nHello 3', 0)