[Zope3-checkins] SVN: Zope3/trunk/src/zope/testbrowser/README.txt add some useful documentation for File Controls.

Chris Withers chris at simplistix.co.uk
Thu Nov 24 10:47:29 EST 2005


Log message for revision 40361:
  add some useful documentation for File Controls.

Changed:
  U   Zope3/trunk/src/zope/testbrowser/README.txt

-=-
Modified: Zope3/trunk/src/zope/testbrowser/README.txt
===================================================================
--- Zope3/trunk/src/zope/testbrowser/README.txt	2005-11-24 13:58:00 UTC (rev 40360)
+++ Zope3/trunk/src/zope/testbrowser/README.txt	2005-11-24 15:47:28 UTC (rev 40361)
@@ -608,6 +608,11 @@
 
   - File Control
 
+    The following is basically unit testing, since most web servers
+    require uploaded files to have a filename, and building a control
+    in the following way means the uploaded file has no name or
+    content type:
+
     >>> ctrl = browser.getControl('File Control')
     >>> ctrl
     <Control name='file-value' type='file'>
@@ -621,6 +626,15 @@
     >>> ctrl.multiple
     False
 
+    Unfortunately, testbrowser doesn't really support what you need,
+    so you have to use the underlying mechanize control:
+
+    >>> ctrl.mech_control.add_file(
+    ...     cStringIO.StringIO('File contents'),
+    ...     content_type='text/plain',
+    ...     filename='test.txt',
+    ...     )
+
   - Selection Control (Single-Valued)
 
     >>> ctrl = browser.getControl('Single Select Control')



More information about the Zope3-Checkins mailing list