Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 52

Show
Ignore:
Timestamp:
12/07/04 11:05:16
Author:
rboerma
Message:

a few fixes and such. .

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/cribeiro-experimental/cherrypy/lib/filter/xyaptufilter.py

    r51 r52  
    9494        - opened files 
    9595        """ 
     96        if cpg.response.headerMap['Content-Type'].split('/')[0] not in ['text']: 
     97            return  
    9698        if fakeResponse!= None: 
    9799            response = fakeResponse 
     
    118120    def beforeResponseFullBody(self): 
    119121        """ Called before writing the full response body """ 
    120         cpg.response.body = cpg.response.xyaptuTemplating.expandedTemplate() 
    121         cpg.response.headerMap['Content-Length']=`len(cpg.response.body)` 
    122         # quite worthless i guess 
     122        if cpg.response.headerMap['Content-Type'].split('/')[0] in ['text']: 
     123            cpg.response.body = cpg.response.xyaptuTemplating.expandedTemplate() 
     124            cpg.response.headerMap['Content-Length']=`len(cpg.response.body)` 
     125            # quite worthless i guess 
  • branches/cribeiro-experimental/cherrypy/remco/filterExampleLogic.py

    r51 r52  
    1919from cherrypy.lib.filter import generatorfilter 
    2020from cherrypy.lib.filter import xmlrpcfilter 
     21import binascii 
    2122 
    2223 
     
    256257        yield ({'bla':'BLA'},"--$bla-- should be uppercase...") 
    257258        yield "this sould contain thereadme<pre>" 
    258         yield ("Readme.txt",{'useless':None}) 
     259        yield ("readme.txt",{'useless':None}) 
    259260        yield "</pre>" 
    260261    testCompoundTemplate.exposed = True 
     
    276277    #_cpFilterList = [generatorfilter.GeneratorFilter(),xmlrpcfilter.XmlRpcFilter()]  
    277278    _cpFilterList = [xyaptufilter.XyaptuFilter()] 
     279    favicon = binascii.a2b_base64( 
     280        'AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAAA' 
     281        'AAAAAAAAAAAAAAEAAAAAAAAABHalAAUHlWAEdiigB4m5MAREvlAEJP/ABK' 
     282        'TvsAtr3aAOjr7wD37/cA9/f3APf3/wD/9/cA//v7APf//wD///8A/3ZlZ6' 
     283        '//qq+oVmZWj/1wz9ZmZmVq9xGvhmVVVVOBEY92ZmVIVBERH6ZlZVRTEQEe' 
     284        '51VkRH8RARr6dkg72hEQGf/e2jr+EREa////s/2BEBn////6N/oRG/////' 
     285        '+jejEa//////9zdxr///////0zB/////////gi////////+pMAAAAAAAAA' 
     286        'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' 
     287        'AAAAAAAAAAAAAAAAAA\n') 
     288 
     289 
    278290    def __init__(self): 
    279291        self.obj = testContainer() 
     
    287299    index.exposed = True 
    288300 
     301  
     302    def default(self,*params): 
     303        if cpg.request.path == '/favicon.ico': 
     304            cpg.response.headerMap['Content-Type'] = "image/x-icon" 
     305            cpg.response.headerMap['Content-Length'] = len(self.favicon) 
     306            return self.favicon 
     307    default.exposed = True 
     308     
    289309    def _cpOnError(self): 
    290310        "Ok, so it works, but it's not nice. . " 
     
    295315        errorBody = bodyFile.getvalue()         
    296316        print errorBody 
    297         if getattr(cpg.request,'isRPC',False): 
    298             import xmlrpclib 
    299             cpg.response.body = xmlrpclib.dumps(xmlrpclib.Fault(1,errorBody)) 
    300         else: 
    301             cpg.response.body = '<pre>%s</pre>' % errorBody 
     317##        if getattr(cpg.request,'isRPC',False): 
     318##            import xmlrpclib 
     319##            cpg.response.body = xmlrpclib.dumps(xmlrpclib.Fault(1,errorBody)) 
     320##        else: 
     321##            cpg.response.body = '<pre>%s</pre>' % errorBody 
     322        cpg.response.body = '<pre>%s</pre>' % errorBody 
    302323     
    303324    def testRPC(self): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets