[Python-modules-commits] r19133 - in packages/twill/trunk/debian (3 files)

arnau at users.alioth.debian.org arnau at users.alioth.debian.org
Tue Nov 1 07:21:01 UTC 2011


    Date: Tuesday, November 1, 2011 @ 07:21:00
  Author: arnau
Revision: 19133

ClientForm is now shipped with mechanize.

Added:
  packages/twill/trunk/debian/patches/04_fix_deprecated_ClientForm.patch
Modified:
  packages/twill/trunk/debian/changelog
  packages/twill/trunk/debian/patches/series

Modified: packages/twill/trunk/debian/changelog
===================================================================
--- packages/twill/trunk/debian/changelog	2011-11-01 07:19:06 UTC (rev 19132)
+++ packages/twill/trunk/debian/changelog	2011-11-01 07:21:00 UTC (rev 19133)
@@ -1,5 +1,7 @@
 twill (0.9-3) UNRELEASED; urgency=low
 
+  * Add debian/patches/04_fix_deprecated_ClientForm.patch as ClientForm
+    is now shipped with mechanize.  
   * debian/patches/02_remove_ext.patch:
     + Fix tests as well.
 

Added: packages/twill/trunk/debian/patches/04_fix_deprecated_ClientForm.patch
===================================================================
--- packages/twill/trunk/debian/patches/04_fix_deprecated_ClientForm.patch	                        (rev 0)
+++ packages/twill/trunk/debian/patches/04_fix_deprecated_ClientForm.patch	2011-11-01 07:21:00 UTC (rev 19133)
@@ -0,0 +1,173 @@
+Index: twill-0.9/twill/browser.py
+===================================================================
+--- twill-0.9.orig/twill/browser.py	2011-11-01 16:07:24.295717438 +0900
++++ twill-0.9/twill/browser.py	2011-11-01 16:14:07.983732789 +0900
+@@ -11,7 +11,7 @@
+ 
+ # wwwsearch imports
+ import mechanize
+-import ClientForm
++import mechanize
+ from mechanize import BrowserStateError, LinkNotFoundError
+ 
+ # twill package imports
+@@ -389,7 +389,7 @@
+             self.last_submit_button = None
+ 
+         # record the last submit button clicked.
+-        if isinstance(control, ClientForm.SubmitControl):
++        if isinstance(control, mechanize.SubmitControl):
+             self.last_submit_button = control
+ 
+     def submit(self, fieldname=None):
+@@ -421,7 +421,7 @@
+             else:
+                 # get first submit button in form.
+                 submits = [ c for c in form.controls \
+-                            if isinstance(c, ClientForm.SubmitControl) ]
++                            if isinstance(c, mechanize.SubmitControl) ]
+ 
+                 if len(submits):
+                     ctl = submits[0]
+@@ -441,7 +441,7 @@
+ Note: submit is using submit button: name="%s", value="%s"
+ """ % (ctl.name, ctl.value)
+             
+-            if isinstance(ctl, ClientForm.ImageControl):
++            if isinstance(ctl, mechanize.ImageControl):
+                 request = ctl._click(form, (1,1), "", mechanize.Request)
+             else:
+                 request = ctl._click(form, True, "", mechanize.Request)
+Index: twill-0.9/twill/commands.py
+===================================================================
+--- twill-0.9.orig/twill/commands.py	2011-11-01 16:07:24.287717438 +0900
++++ twill-0.9/twill/commands.py	2011-11-01 16:14:07.983732789 +0900
+@@ -5,7 +5,7 @@
+ 
+ import sys
+ import mechanize
+-import ClientForm
++import mechanize
+ from mechanize._headersutil import is_html
+ 
+ OUT=None
+@@ -440,11 +440,11 @@
+         print>>OUT, 'forcing read-only form field to writeable'
+         control.readonly = False
+         
+-    if control.readonly or isinstance(control, ClientForm.IgnoreControl):
++    if control.readonly or isinstance(control, mechanize.IgnoreControl):
+         print>>OUT, 'form field is read-only or ignorable; nothing done.'
+         return
+ 
+-    if isinstance(control, ClientForm.FileControl):
++    if isinstance(control, mechanize.FileControl):
+         raise TwillException('form field is for file upload; use "formfile" instead')
+ 
+     set_form_control_value(control, value)
+Index: twill-0.9/twill/utils.py
+===================================================================
+--- twill-0.9.orig/twill/utils.py	2011-11-01 16:07:24.303717438 +0900
++++ twill-0.9/twill/utils.py	2011-11-01 16:14:07.983732789 +0900
+@@ -12,7 +12,7 @@
+ import subprocess
+ 
+ import mechanize
+-import ClientForm
++import mechanize
+ from mechanize._util import time
+ from mechanize._http import HTTPRefreshProcessor
+ from mechanize import BrowserStateError
+@@ -150,17 +150,17 @@
+     """
+     Helper function to deal with setting form values on checkboxes, lists etc.
+     """
+-    if isinstance(control, ClientForm.CheckboxControl):
++    if isinstance(control, mechanize.CheckboxControl):
+         try:
+             checkbox = control.get()
+             checkbox.selected = make_boolean(val)
+             return
+-        except ClientForm.AmbiguityError:
++        except mechanize.AmbiguityError:
+             # if there's more than one checkbox, use the behaviour for
+-            # ClientForm.ListControl, below.
++            # mechanize.ListControl, below.
+             pass
+             
+-    if isinstance(control, ClientForm.ListControl):
++    if isinstance(control, mechanize.ListControl):
+         #
+         # for ListControls (checkboxes, multiselect, etc.) we first need
+         # to find the right *value*.  Then we need to set it +/-.
+@@ -181,13 +181,13 @@
+ 
+         try:
+             item = control.get(name=val)
+-        except ClientForm.ItemNotFoundError:
++        except mechanize.ItemNotFoundError:
+             try:
+                 item = control.get(label=val)
+-            except ClientForm.AmbiguityError:
+-                raise ClientForm.ItemNotFoundError('multiple matches to value/label "%s" in list control' % (val,))
+-            except ClientForm.ItemNotFoundError:
+-                raise ClientForm.ItemNotFoundError('cannot find value/label "%s" in list control' % (val,))
++            except mechanize.AmbiguityError:
++                raise mechanize.ItemNotFoundError('multiple matches to value/label "%s" in list control' % (val,))
++            except mechanize.ItemNotFoundError:
++                raise mechanize.ItemNotFoundError('cannot find value/label "%s" in list control' % (val,))
+ 
+         if flag:
+             item.selected = 1
+Index: twill-0.9/tests/test-checkbox.py
+===================================================================
+--- twill-0.9.orig/tests/test-checkbox.py	2011-11-01 16:12:48.751729776 +0900
++++ twill-0.9/tests/test-checkbox.py	2011-11-01 16:14:59.267734741 +0900
+@@ -3,7 +3,6 @@
+ from twill import namespaces, commands
+ from twill.errors import TwillAssertionError
+ import mechanize
+-import ClientForm
+ 
+ def setup_module():
+     global url
+Index: twill-0.9/tests/test-encoding.py
+===================================================================
+--- twill-0.9.orig/tests/test-encoding.py	2011-11-01 16:11:54.079727697 +0900
++++ twill-0.9/tests/test-encoding.py	2011-11-01 16:14:45.851734229 +0900
+@@ -1,5 +1,5 @@
+ import twilltestlib
+-import ClientForm
++import mechanize
+ from cStringIO import StringIO
+ 
+ def test_form_parse():
+@@ -7,5 +7,5 @@
+     fp = StringIO(content)
+ 
+     # latin-1...
+-    ClientForm.ParseFile(fp, "<test-encoding.py fp>", encoding='latin-1',
+-                         backwards_compat=False)
++    mechanize.ParseFile(fp, "<test-encoding.py fp>", encoding='latin-1',
++                        backwards_compat=False)
+Index: twill-0.9/tests/test-form.py
+===================================================================
+--- twill-0.9.orig/tests/test-form.py	2011-11-01 16:13:20.135730970 +0900
++++ twill-0.9/tests/test-form.py	2011-11-01 16:14:29.291733600 +0900
+@@ -2,7 +2,6 @@
+ import twill
+ from twill import namespaces, commands
+ from twill.errors import TwillAssertionError
+-import ClientForm
+ import mechanize
+ 
+ def test():
+@@ -44,7 +43,7 @@
+     try:
+         commands.fv('1', 'selecttest', 'value')
+         assert 0
+-    except ClientForm.ItemNotFoundError:
++    except mechanize.ItemNotFoundError:
+         pass
+ 
+     # test ambiguous match to name

Modified: packages/twill/trunk/debian/patches/series
===================================================================
--- packages/twill/trunk/debian/patches/series	2011-11-01 07:19:06 UTC (rev 19132)
+++ packages/twill/trunk/debian/patches/series	2011-11-01 07:21:00 UTC (rev 19133)
@@ -1,3 +1,4 @@
 01_fix_history_path.patch
 02_remove_ext.patch
 03_no_setuptools.patch
+04_fix_deprecated_ClientForm.patch




More information about the Python-modules-commits mailing list