Ticket #3 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Add DSL-style signature functions for Applets

Reported by: deveiant Owned by: deveiant
Priority: normal Milestone: Theres No Step Three
Component: Applet Version: 0.1
Severity: normal Keywords: applet dsl validation signature
Cc:

Description

It's a pain in the arse, not to mention ugly, to have to set up the signature via one big hash in every Applet file.

Instead of:

Signature = {
    :name => "Argument Tester",
    :description => "This app is for testing/debugging the argument validator.",
    :maintainer => "ged@FaerieMUD.org",
    :defaultAction => 'display',
    :templates => {
        :display    => 'args-display.tmpl',
    },
    :vargs => {
        :display    => {
            :required       => :name,
            :optional       => [:email, :description],
            :filters        => [:strip, :squeeze],
            :untaint_all_constraints => true,
            :descriptions   => {
                :email          => "Customer Email",
                :description    => "Issue Description",
                :name           => "Customer Name",
            },
            :constraints    => {
                :email  => :email,
                :name   => /^[\x20-\x7f]+$/,
                :description => /^[\x20-\x7f]+$/,
            },
        },
    },
}

It would look something like:

applet_name "Argument Tester"
applet_description "This app is for testing/debugging the argument validator."
applet_maintainer "ged@FaerieMUD.org",
default_action :display

template :display => 'args-display.tmpl'

validation :display,
    :required => :name,
    :optional => [:email, :description],
    :filters => [:strip, :squeeze],
    :untaint_all_constraints => true,
    :descriptions => {
        :email          => "Customer Email",
        :description    => "Issue Description",
        :name           => "Customer Name",
    },
    :constraints => {
        :email  => :email,
        :name   => /^[\x20-\x7f]+$/,
        :description => /^[\x20-\x7f]+$/,
    }

The validation stuff is still a bit complex, but validation is inherently a complex task. Perhaps it could be broken down by argument or something?

Change History

Changed 3 years ago by deveiant

  • status changed from new to closed
  • resolution set to fixed

This was committed in [284].

Note: See TracTickets for help on using tickets.