mς ‘γΈEc@s£dZdkZdkZdklZdklZdkZdeifd„ƒYZdei fd„ƒYZ dei fd „ƒYZ d ei fd „ƒYZ dS( sjSupport for using zope.testbrowser from Zope2. Mostly just copy and paste from zope.testbrowser.testing. N(stesting(sbrowsertPublisherConnectioncBstZd„Zd„ZRS(NcCs#dkl}||_||_dS(N(shttp(t+Testing.ZopeTestCase.zopedoctest.functionalthttptselftcallerthost(RRR((t8/data/zmath/zope/lib/python/Products/Five/testbrowser.pyt__init__s  c Cs½|ii} | iƒ}tiii | i} g} xβ| i i ƒD]Ρ\} }| iƒ| joŸd| d iƒ| df} d}| id|ƒ}xf||joTd| | | |d|d!iƒ| |df} |d}| id|ƒ}qœWn| i| |fƒqDWg}| iƒD]}||d |dfq*~}| i|ƒ| iƒ| idd d || ffƒd id „| Dƒƒ} | i}ti || || ƒS(sάReturn a ``urllib2`` compatible response. The goal of ths method is to convert the Zope Publisher's reseponse to a ``urllib2`` compatible response, which is also understood by mechanize. s%s%siit-s%s-%s%sii i tStatuss%s %ss ccsx|]}d|VqWdS(s%s: %sN(t[outmost-iterable]th(R R ((Rt3sN(!Rtresponset _responset real_responset getStatuststatustzopet publisherRtstatus_reasonstreasontheaderstitemstkeytvaltlowertuppertstarttfindtltappendt_[1]t _cookie_listtctcookiestextendtsorttinserttjointbodytcontentttestingtPublisherResponse( RRR)R#RRR"RR RRRR((Rt getresponses0    4 5    (t__name__t __module__RR,(((RRs tPublisherHTTPHandlercBs#tZdZeiiZd„ZRS(s/Special HTTP handler to use the Zope Publisher.cCs|it|ƒS(s5Open an HTTP connection having a ``urllib2`` request.N(Rtdo_openRtreq(RR1((Rt http_open=s(R-R.t__doc__turllib2tAbstractHTTPHandlert do_request_t http_requestR2(((RR/8s  tPublisherMechanizeBrowsercBsMtZdZdgZdddgZddddd d d d gZd „ZRS(sDSpecial ``mechanize`` browser using the Zope Publisher HTTP handler.Rt _http_errort_http_request_upgradet_http_default_errort _redirectt_cookiest_referert_refresht_equivt _basicautht _digestautht_seekc Osddddddddd d d d d g }hdt<|_x%|D]}tii||i|R?R@RCt_gzipR( tinherited_handlersR/Rthandler_classestnamet mechanizetBrowserRtargstkws(RRKRLRHRF((RRLs -(R-R.R3tdefault_schemestdefault_otherstdefault_featuresR(((RR8Cs  RJcBstZdZed„ZRS(s;A Zope ``testbrowser` Browser that uses the Zope Publisher.cCs9tƒ}t|id