               [1]Billy-Bob Ming               * [3]Billy-Bob's Ming Server
             [2]Get The Good Stuff             * [4]Ming Server Manual
                                               * [5]Ming Server Python Data Type
       Ming Server Incoming Data Handler

    A General Handling of Form Data

    This incoming handler  does not  replace CGI  scripts but it  obviates the  need for  many of them.  If the  page you  are
    generating needs the form itself, you need a CGI script. Otherwise, our incoming data handling should be sufficient.

    If "incoming" is a key in the cgi.form, ming.cgi expects these keys in the form data:

      * file - ming enters this into FILES, a read-write access file in FILES_DIR
      * page - valid ming.cgi page target

    It will use these USER CONSTS in Constants.py:

      * FILES_DIR = "../data/files" # Must be read/write dir for the webserver
      * FILE_MAXLINES = 1000 # Upper limit on text file length
      * INCOMING_MAX = 64*1024 # Upper limit on incoming data

    FILES contains name only, one on each line, no paths. Ming writes name in FILES and reads up FILES_DIR+os.sep+file It then
    opens it for writing and writes a datestamp of the form

      stamp|xxxxxxxxx.xxx

    where the Xs are time in seconds converted to string, followed by

      key|form[key].value()\n

    for all keys but file, page, incoming, submit, and debug. (It only writes after testing sizes against INCOMING_MAX.)  Then
    it writes "---\n" and closes the file.

    Finally, it opens form["page"].value() in the client browser.

    So, you can have a page with a form. It's incoming value  triggers both the writing of the data and the triggering of  the
    page which uses the data.

    It is useful to have an empty  dir with single-page subdirs for these  page targets. I have, for example,  /singles/thanks
    dir with a key file and a thankyou file. It thanks you for filling out a form and links back to a useful page.

    Text files are truncated at FILE_MAXLINES. So your code must handle abrupt truncation. I use try-except clauses.

                 [6]We Publish                           [8]You Publish                           [10]You Write
                 [7]We Publish                           [9]You Publish                           [11]You Write
                                                  [12]WHAT'S HOT ON BILLY-BOB?
          [13]Free Software Foundation                 [15]billy-bob ming                  [17]Creative Commons License
               [14]GPL'D Software                       [16]Our Founders                      [18]Copyrighted Works

References

   Visible links
   1. http://192.168.56.2/billybobming.html
   2. http://192.168.56.2/billybobming.html
   3. http://192.168.56.2/cgibin/ming.cgi?page=sites/ming/index
   4. http://192.168.56.2/cgibin/ming.cgi?page=sites/ming/01server/index
   5. http://192.168.56.2/cgibin/ming.cgi?page=sites/ming/01server/pytype
   6. http://billy-bob-ming.com/cgibin/ming.cgi?page=sites/billybob/breakfast
   7. http://billy-bob-ming.com/cgibin/ming.cgi?page=sites/billybob/breakfast
   8. http://billy-bob-ming.com/cgibin/ming.cgi?page=sites/ming/index
   9. http://billy-bob-ming.com/cgibin/ming.cgi?page=sites/ming/index
  10. http://billy-bob-ming.com/ghostwriter/
  11. http://billy-bob-ming.com/ghostwriter/
  12. http://192.168.56.2/cgibin/ming.cgi?page=open/logger/hits
  13. http://www.fsf.org/
  14. http://www.fsf.org/
  15. http://billy-bob-ming.com/billybobming.html
  16. http://billy-bob-ming.com/billybobming.html
  17. http://creativecommons.org/licenses/by-nc-nd/2.5/
  18. http://creativecommons.org/licenses/by-nc-nd/2.5/
