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

Changeset 96

Show
Ignore:
Timestamp:
12/29/04 09:48:29
Author:
rdelon
Message:

small fixes for new cpg.response.body iterable type; getting ready for 2.0.0b release

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog.txt

    r79 r96  
     12004/12-29: 
     2        * CherryPY-2.0-beta released 
     3        * cpg.response.body is now always an iterable type - ticket #59 (Carlos) 
    14        * Allowed default session functions to be accessed by other modules - 
    25        ticket #56 (Remi) 
  • trunk/cherrypy/__init__.py

    r8 r96  
    1 __version__ = '2.0.0a2
     1__version__ = '2.0.0b
  • trunk/cherrypy/_cphttptools.py

    r95 r96  
    206206 
    207207            wfile.write('%s %s\r\n' % (cpg.response.headerMap['protocolVersion'], cpg.response.headerMap['Status'])) 
    208             if cpg.response.headerMap.has_key('Content-Length') and cpg.response.headerMap['Content-Length'] == 0: 
    209                 cpg.response.headerMap['Content-Length'] = len(cpg.response.body) 
     208 
     209            if (cpg.response.headerMap.has_key('Content-Length') and 
     210                    cpg.response.headerMap['Content-Length']==0): 
     211                        buf = StringIO.StringIO() 
     212                        [buf.write(x) for x in cpg.response.body] 
     213                        buf.seek(0) 
     214                        cpg.response.body = [buf.read()] 
     215                        cpg.response.headerMap['Content-Length'] = len(cpg.response.body[0]) 
     216 
    210217            for key, valueList in cpg.response.headerMap.items(): 
    211218                if key not in ('Status', 'protocolVersion'): 
     
    214221                        wfile.write('%s: %s\r\n'%(key, value)) 
    215222            wfile.write('\r\n') 
    216             wfile.write(cpg.response.body) 
     223            for line in cpg.response.body: 
     224                wfile.write(line) 
    217225        except: 
    218226            bodyFile = StringIO.StringIO() 
     
    236244    # Set the content-length 
    237245    if (cpg.response.headerMap.has_key('Content-Length') and 
    238         cpg.response.headerMap['Content-Length']==0): 
    239         #body = ""  
    240         #body = ''.join(list(cpg.response.body))  # a local var is more efficient here 
    241         #body = u''.join(cpg.response.body)  # a local var is more efficient here 
    242         #body = '' 
    243         #for line in cpg.response.body: 
    244         #    print body 
    245         #    body += line 
     246            cpg.response.headerMap['Content-Length']==0): 
    246247        buf = StringIO.StringIO() 
    247248        [buf.write(x) for x in cpg.response.body] 
  • trunk/cherrypy/lib/filter/tidyfilter.py

    r95 r96  
    3434        # so we just collect the body and work with it. 
    3535        originalBody = ''.join(cpg.response.body) 
     36        cpg.response.body = [originalBody] 
    3637         
    37         ct = cpg.response.headerMap.get('Content-Type') 
     38        ct = cpg.response.headerMap.get('Content-Type').split(';')[0] 
    3839        if ct == 'text/html': 
    3940            pageFile = os.path.join(self.tmpDir, 'page.html') 
     
    6768                newBody += '<br><br>' 
    6869                i=0 
    69                 for line in oldHtml.splitlines(): 
     70                for line in originalBody.splitlines(): 
    7071                    i += 1 
    7172                    newBody += "%03d - "%i + cgi.escape(line).replace('\t','    ').replace(' ','&nbsp;') + '<br>' 
  • trunk/cherrypy/lib/httptools.py

    r13 r96  
    3434    cpg.response.headerMap['Status'] = 302 
    3535    cpg.response.headerMap['Location'] = newUrl 
    36     return "" 
     36    return [] 
  • trunk/setup.py

    r15 r96  
    99 
    1010setup(name="CherryPy", 
    11       version="2.0.0a2", 
     11      version="2.0.0b", 
    1212      description="Object-Oriented web development framework", 
    1313      long_description="""CherryPy is a pythonic, object-oriented web development framework.""", 

Hosted by WebFaction

Log in as guest/cpguest to create tickets