<commit_before>from bo import *
from database import *


class ShowPreferences(boRequestHandler):
    def get(self):
        self.view('preferences', 'preferences.html', {
            'person': Person().current,
            'preferences': UserPreferences().current,
        })

    def post(self):
        UserPreferences().set_language(self.request.get('language'))


def main():
    Route([
             ('/preferences', ShowPreferences),
            ])


if __name__ == '__main__':
    main()<commit_msg>Save user timezone<commit_after>from pytz.gae import pytz

from bo import *
from database.person import *


class ShowPreferences(boRequestHandler):
    def get(self):
        self.view('preferences', 'preferences.html', {
            'person': Person().current,
            'preferences': UserPreferences().current,
            'timezones': pytz.common_timezones,
        })

    def post(self):
        field = self.request.get('field').strip()
        value = self.request.get('value').strip()

        UserPreferences().set(field, value)


def main():
    Route([
             ('/preferences', ShowPreferences),
            ])


if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.14103653355989804, 'fraction_numerical': 0.0, 'mean_word_length': 2.602446483180428, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '742738', 'n_tokens_mistral': 337, 'n_tokens_neox': 324, 'n_words': 68}