Return-Path: <twisted-commits-admin@twistedmatrix.com>
Delivered-To: warner-twistedcvs@luther.lothar.com
Received: (qmail 32220 invoked by uid 1000); 14 Jan 2003 21:50:04 -0000
Delivered-To: warner-twistedcvs@lothar.com
Received: (qmail 7923 invoked by uid 13574); 14 Jan 2003 21:49:48 -0000
Received: from unknown (HELO pyramid.twistedmatrix.com) ([64.123.27.105]) (envelope-sender <twisted-commits-admin@twistedmatrix.com>)
          by 130.94.181.6 (qmail-ldap-1.03) with SMTP
          for <warner-twistedcvs@lothar.com>; 14 Jan 2003 21:49:48 -0000
Received: from localhost ([127.0.0.1] helo=pyramid.twistedmatrix.com)
	by pyramid.twistedmatrix.com with esmtp (Exim 3.35 #1 (Debian))
	id 18YYr0-0005en-00; Tue, 14 Jan 2003 15:44:14 -0600
Received: from acapnotic by pyramid.twistedmatrix.com with local (Exim 3.35 #1 (Debian))
	id 18YYq7-0005eQ-00
	for <twisted-commits@twistedmatrix.com>; Tue, 14 Jan 2003 15:43:19 -0600
To: twisted-commits@twistedmatrix.com
From: itamarst CVS <itamarst@twistedmatrix.com>
Reply-To: twisted-python@twistedmatrix.com
X-Mailer: CVSToys
From: itamarst CVS <itamarst@twistedmatrix.com>
Reply-To: twisted-python@twistedmatrix.com
Message-Id: <E18YYq7-0005eQ-00@pyramid.twistedmatrix.com>
Subject: [Twisted-commits] submit formmethod now subclass of Choice
Sender: twisted-commits-admin@twistedmatrix.com
Errors-To: twisted-commits-admin@twistedmatrix.com
X-BeenThere: twisted-commits@twistedmatrix.com
X-Mailman-Version: 2.0.11
Precedence: bulk
List-Help: <mailto:twisted-commits-request@twistedmatrix.com?subject=help>
List-Post: <mailto:twisted-commits@twistedmatrix.com>
List-Subscribe: <http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-commits>,
	<mailto:twisted-commits-request@twistedmatrix.com?subject=subscribe>
List-Id: <twisted-commits.twistedmatrix.com>
List-Unsubscribe: <http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-commits>,
	<mailto:twisted-commits-request@twistedmatrix.com?subject=unsubscribe>
List-Archive: <http://twistedmatrix.com/pipermail/twisted-commits/>
Date: Tue, 14 Jan 2003 15:43:19 -0600
Status:   

Modified files:
Twisted/twisted/web/woven/form.py 1.20 1.21
Twisted/twisted/python/formmethod.py 1.12 1.13

Log message:
submit formmethod now subclass of Choice


Index: Twisted/twisted/web/woven/form.py
diff -u Twisted/twisted/web/woven/form.py:1.20 Twisted/twisted/web/woven/form.py:1.21
--- Twisted/twisted/web/woven/form.py:1.20	Tue Jan 14 12:07:29 2003
+++ Twisted/twisted/web/woven/form.py	Tue Jan 14 13:43:16 2003
@@ -140,8 +140,8 @@
 
     def input_submit(self, request, content, arg):
         div = content.div()
-        for value in arg.buttons:
-            div.input(type="submit", name=arg.name, value=value)
+        for tag, value, desc in arg.choices:
+            div.input(type="submit", name=arg.name, value=tag)
             div.text(" ")
         if arg.reset:
             div.input(type="reset")

Index: Twisted/twisted/python/formmethod.py
diff -u Twisted/twisted/python/formmethod.py:1.12 Twisted/twisted/python/formmethod.py:1.13
--- Twisted/twisted/python/formmethod.py:1.12	Tue Jan 14 12:07:30 2003
+++ Twisted/twisted/python/formmethod.py	Tue Jan 14 13:43:17 2003
@@ -180,19 +180,13 @@
         return 1
 
 
-class Submit(Argument):
+class Submit(Choice):
     """Submit button or a reasonable facsimile thereof."""
 
-    def __init__(self, name, buttons=["Submit"], reset=0, shortDesc=None, longDesc=None):
-        Argument.__init__(self, name, shortDesc=shortDesc, longDesc=longDesc)
-        self.buttons = buttons
+    def __init__(self, name, choices=[("Submit", "submit", "Submit form")],
+                 reset=0, shortDesc=None, longDesc=None):
+        Choice.__init__(self, name, choices=choices, shortDesc=shortDesc, longDesc=longDesc)
         self.reset = reset
-
-    def coerce(self, val):
-        if val in self.buttons:
-            return val
-        else:
-            raise InputError, "no such action"
 
 
 class PresentationHint:

.

_______________________________________________
Twisted-commits mailing list
Twisted-commits@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-commits
