CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-flask-wtf

tessl install tessl/pypi-flask-wtf@1.2.0

Form rendering, validation, and CSRF protection for Flask with WTForms.

Agent Success

Agent success rate when using this tile

72%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.91x

Baseline

Agent success rate without this tile

79%

task.mdevals/scenario-5/

Document Upload Form

A simple Flask web application that allows users to upload documents with required file validation.

Capabilities

Document Upload Validation

  • When the form is submitted without a file, validation fails and returns an error @test
  • When the form is submitted with a valid file, validation succeeds and the filename is returned @test
  • When the form is submitted with an empty FileStorage object, validation fails @test

Implementation

@generates

API

from flask_wtf import FlaskForm

class DocumentUploadForm(FlaskForm):
    """
    A form for uploading documents that requires a file to be present.

    The form should:
    - Have a field named 'document' for file uploads
    - Ensure that a file is actually uploaded (not just an empty form submission)
    - Use appropriate validation to enforce file presence
    """
    pass


def process_upload(form):
    """
    Process the upload form and return the uploaded filename if validation succeeds.

    Args:
        form: A DocumentUploadForm instance populated with request data

    Returns:
        A dictionary with either:
        - {'success': True, 'filename': str} if validation passes
        - {'success': False, 'error': str} if validation fails
    """
    pass

Dependencies { .dependencies }

Flask-WTF { .dependency }

Provides form handling, file upload fields, and file validation capabilities for Flask applications.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/flask-wtf@1.2.x
tile.json