<commit_before>
from formencode import Schema, Invalid

from glashammer.controller import Controller


class CrudController(Controller):

    """
    A basic crud controller
    """

    base_url = None
    index_template = None
    view_template = None
    form_template = None
    model_type = None
    schema_type = None

    def index(self, req):
        return self.create_template_response(req, self.index_template,
                items=self.site.storm.store.find(self.model_type))

    def view(self, req, id):
        item = self.site.storm.store.find(self.model_type, id=id).one()
        if item is None:
            return NotFoundResponse()
        else:
            return self.create_template_response(req, self.view_template,
                                             item=item)

    def edit(self, req, id):
        item = self._get_item_for_id(id)<commit_msg>[project @ <EMAIL>-20071130042942-suwsuvt42ix66z4j] some crud controller<commit_after>
from formencode import Schema, Invalid

from glashammer.controller import Controller
from werkzeug.routing import Rule


class CrudController(Controller):

    """
    A basic crud controller
    """

    base_url = None
    index_template = None
    view_template = None
    form_template = None
    model_type = None
    schema_type = None

    def index(self, req):
        return self.create_template_response(req, self.index_template,
                items=self.site.storm.store.find(self.model_type))

    def view(self, req, id):
        item = self.site.storm.store.find(self.model_type, id=id).one()
        if item is None:
            return NotFoundResponse()
        else:
            return self.create_template_response(req, self.view_template,
                                             item=item)

    def edit(self, req, id):
        item = self._get_item_for_id(id)
{'fraction_non_alphanumeric': 0.08634646519158122, 'fraction_numerical': 0.01025364274150027, 'mean_word_length': 2.401834862385321, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3172890', 'n_tokens_mistral': 553, 'n_tokens_neox': 526, 'n_words': 125}