<commit_before>from django import forms
from django.core.urlresolvers import reverse


from two.ol.base import FormHandler
from wheelcms_axle.models import Configuration
from wheelcms_axle.toolbar import Toolbar
from wheelcms_axle.base import WheelHandlerMixin

class ConfigurationForm(forms.ModelForm):
    class Meta:
        model = Configuration

    theme = forms.ChoiceField(choices=(
        ('default', 'Bootstrap'),
        ('amelia', 'Amelia'),
        ('cerulean', 'Cerulean'),
        ('cosmo', 'Cosmo'),
        ('cyborg', 'Cyborg'),
        ('journal', 'Journal'),
        ('readable', 'Readable'),
        ('simplex', 'Simplex'),
        ('slate', 'Slate'),
        ('spruce', 'Spruce'),
        ('superhero', 'Superhero'),
        ('united', 'United')))

class ConfigurationHandler(FormHandler, WheelHandlerMixin):
    ## get "shared" context/setup
    model = Configuration

    def update_context(self, request):
        super(ConfigurationHandler, self).update_context(request)
        self.context['toolbar'] = Toolbar(instance=None, status="special")

    def index(self):
        instance = Configuration.config()
        self.context['form'] = ConfigurationForm(instance=instance)
        ## set redirect_to
        return self.template("wheelcms_axle/configuration.html")

    def process(self):
        instance = Configuration.config()
        self.context['form'] = form = \
                 ConfigurationForm(self.request.POST, instance=instance)
        if form.is_valid():
            form.save()
            return self.redirect(reverse('wheel_config'), success="Changes saved")
        return self.template("wheelcms_axle/configuration.html")<commit_msg>dead code<commit_after>from django import forms
from django.core.urlresolvers import reverse


from two.ol.base import FormHandler
from wheelcms_axle.models import Configuration
from wheelcms_axle.toolbar import Toolbar
from wheelcms_axle.base import WheelHandlerMixin

class ConfigurationForm(forms.ModelForm):
    class Meta:
        model = Configuration

    theme = forms.ChoiceField(choices=(
        ('default', 'Bootstrap'),
        ('amelia', 'Amelia'),
        ('cerulean', 'Cerulean'),
        ('cosmo', 'Cosmo'),
        ('cyborg', 'Cyborg'),
        ('journal', 'Journal'),
        ('readable', 'Readable'),
        ('simplex', 'Simplex'),
        ('slate', 'Slate'),
        ('spruce', 'Spruce'),
        ('superhero', 'Superhero'),
        ('united', 'United')))

class ConfigurationHandler(FormHandler, WheelHandlerMixin):
    def update_context(self, request):
        super(ConfigurationHandler, self).update_context(request)
        self.context['toolbar'] = Toolbar(instance=None, status="special")

    def index(self):
        instance = Configuration.config()
        self.context['form'] = ConfigurationForm(instance=instance)
        ## set redirect_to
        return self.template("wheelcms_axle/configuration.html")

    def process(self):
        instance = Configuration.config()
        self.context['form'] = form = \
                 ConfigurationForm(self.request.POST, instance=instance)
        if form.is_valid():
            form.save()
            return self.redirect(reverse('wheel_config'), success="Changes saved")
        return self.template("wheelcms_axle/configuration.html")
{'fraction_non_alphanumeric': 0.13244632597520412, 'fraction_numerical': 0.0, 'mean_word_length': 3.2247765006385696, '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': '458383', 'n_tokens_mistral': 914, 'n_tokens_neox': 878, 'n_words': 193}