# Copyright (C) 2004 Marc O. Sandlus # CHANGEME! # Homepage: http://www.matheraum.de/werkzeuge # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. werkzeugid = "beispiel" # CHANGEME "beispiel" durch den Namen des werkzeugs ersetzen author = "Marc O. Sandlus" # CHANGEME licence = "GNU General Public License" username = "matux" # CHANGEME MatheRaum-Username für direkte Verlinkung auf das Profil def webform( reqform, results=0 ): """ Eingabe: reqform: Dictionary der Formularwerte; alle Werte sind Strings. results: 0: Keine Berechnung, nur Ausgabe eines leeren Formulars 1: Liefere Ergebnis der Berechnung zurück, inklusive Formular Ausgabe: Dictionary, mit den Keys 'title' und 'html'. """ # Default-Werte für Formularwerte form = { 'werkzeug': werkzeugid, # DONTCHANGE 'wert1': '', # "wert1" ggfs. ändern 'wert2': '', # ggfs. weitere Formular-Felder } form.update( reqform ) # Rückgabe-Objekt res = { 'title': 'Beispiel-Werkzeug für Entwickler' } # CHANGEME s = "" s += '
Muster-Beispiel eines MatheRaum-Werkzeuges
\n' s += '''Download des Python-Quelltextes, als Vorlage für Entwickler neuer MatheRaum-Werkzeuge.
''' # DONTCHANGE--> s += '\n' error = "" if results and ( form['wert1'] or form['wert2'] ): try: wert1 = int( form['wert1'] ) wert2 = int( form['wert2'] ) error = "" except ValueError: error = "Fehler beim Interpretieren der Eingaben." except TypeError: error = "Fehler beim Interpretieren der Eingaben." if not error: result, error = main( wert1, wert2 ) if not error: s += 'Ergebnis: %s