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

'''Generates the main page.'''

import re

from google.appengine.ext import webapp

import vkfeed.util


class MainPage(webapp.RequestHandler):
    '''Generates the main page.'''


    def get(self):
        '''Processes a GET request.'''

        self.response.out.write(vkfeed.util.render_template('main.html'))


    def post(self):
        '''Processes a POST request.'''

        profile_url = self.request.get('profile_url', '')

        match = re.match(r'''^
            \s*
            (?:https?://(?:www\.)?(?:vk\.com|vkontakte\.ru)/)?
            (?P<profile_id>[a-zA-Z0-9_-]{5,})/?
            \s*
        $''', profile_url, re.IGNORECASE | re.VERBOSE)

        if match:
            self.redirect('/feed/' + match.group('profile_id') + '/wall')
        else:
            self.response.out.write(vkfeed.util.render_template('main.html', {<commit_msg>Support of old profile names<commit_after># -*- coding: utf-8 -*-

'''Generates the main page.'''

import re

from google.appengine.ext import webapp

import vkfeed.util


class MainPage(webapp.RequestHandler):
    '''Generates the main page.'''


    def get(self):
        '''Processes a GET request.'''

        self.response.out.write(vkfeed.util.render_template('main.html'))


    def post(self):
        '''Processes a POST request.'''

        profile_url = self.request.get('profile_url', '')

        match = re.match(r'''^
            \s*
            (?:https?://(?:www\.)?(?:vk\.com|vkontakte\.ru)/)?
            (?P<profile_id>[a-zA-Z0-9._-]{5,})/?
            \s*
        $''', profile_url, re.IGNORECASE | re.VERBOSE)

        if match:
            self.redirect('/feed/' + match.group('profile_id') + '/wall')
        else:
            self.response.out.write(vkfeed.util.render_template('main.html', {
{'fraction_non_alphanumeric': 0.18626373626373627, 'fraction_numerical': 0.004395604395604396, 'mean_word_length': 2.2870036101083033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5484258', 'n_tokens_mistral': 626, 'n_tokens_neox': 585, 'n_words': 108}