John R. Daily writes:
Does anyone have any further examples of importing Zope and HTTPRequest and setting up fake requests? My internet searches are not pulling up much with "import HTTPRequest". I use:
import os, sys sys.path.append('lib/python') from ZPublisher.Request import Request from ZPublisher.Response import Response from ZPublisher.Publish import get_module_info from base64 import encodestring e=os.environ e['SERVER_NAME']= 'localhost'; e['SERVER_PORT']= '8080' e['SCRIPT_NAME']= '' (bobo_before, bobo_after, object, realm, debug_mode, err_hook, sec_manager, have_transactions)= get_module_info('Zope') def getRequest(): request= Request(sys.stdin, e, Response(), ) request['PARENTS']= [object] return request def getAuthRequest(): r=getRequest() r._auth='basic ' + encodestring('dieter:s') return r
participants (1)
-
Dieter Maurer