<commit_before># -*- coding: utf-8 -*-

import utils


from basehandler import BaseHandler


class WikiPage(BaseHandler):
    def get(self, PAGE_RE):
        p = utils.get_page(PAGE_RE)
        if p is None:
            self.redirect('/_edit' + PAGE_RE)
        else:
            self.render('/templates/wikipage.html',
                        content=p.content)<commit_msg>Update wikipage.py<commit_after># -*- coding: utf-8 -*-

import utils


from basehandler import BaseHandler


class WikiPage(BaseHandler):
    def get(self, PAGE_RE):
        p = utils.get_page(PAGE_RE)
        username = self.get_username()
        login = True if username else False

        if p is None:
            if login:
                content = ''    # empty content
                p = utils.create_page(PAGE_RE, content)
                self.redirect('/_edit' + PAGE_RE)
            else:
                self.response.write('This page does not exist. '
                                    'Please log in to create it.')
        else:
            self.render('/templates/wikipage.html',
                        login=login,
                        username=username,
                        page=p)
{'fraction_non_alphanumeric': 0.09780775716694773, 'fraction_numerical': 0.0016863406408094434, 'mean_word_length': 1.5309168443496801, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6736262', 'n_tokens_mistral': 328, 'n_tokens_neox': 317, 'n_words': 80}