print('extraprint('% \ (cgi escape(textor '?')if has def viewattachmentlinks(partnames)""create hyperlinks to locally saved part/attachment files when clickeduser' web browser will handle opening assumes just one useronly valid while viewing msg ""print('parts:'for filename in partnamesbasename os path basename(filenamefilename filename replace('\\''/'windows hack print('% (filenamebasename)print(''def viewpage(msgnumheaderstextformparts=[])""on view select (generated link clickvery subtle thingat this pointpswd was url encoded in the linkand then unencoded by cgi input parserit' being embedded in html hereso we use cgi escapethis usually sends nonprintable chars in the hidden field' htmlbut works on ie and ns anyhowin url?user=lutz&mnum= &pswd=% cg% % % % % % % in htmlcould urllib parse quote html field here toobut must urllib parse unquote in next script (which precludes passing the inputs in url instead of the form)can also fall back on numeric string fmt in secret py ""pageheader(kind='view'userpswdsite list(map(cgi escapegetstandardpopfields(form))print('urlrootprint('msgnumprint('userfrom page|url print('sitefor deletes print('pswdpswd encoded messagearea(headerstext'readonly'if partsviewattachmentlinks(partsonviewpageaction quotetext needs date passed in page print('headers get('date','?')print('action:'print(''print(replyforwarddelete'print(''print(''no 'resetneeded here pagefooter(def sendattachmentwidgets(maxattach= )print('attach:'for in range( maxattach+ )print('iprint(''utility modules