Issue Details (XML | Word | Printable)

Key: MODPYTHON-15
Type: Improvement Improvement
Status: Reopened Reopened
Priority: Minor Minor
Assignee: Nicolas Lehuen
Reporter: Nicolas Lehuen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
mod_python

Publisher : iterable return values should be corretly published

Created: 29/Jan/05 09:14 PM   Updated: 13/Aug/06 07:49 AM
Return to search
Component/s: None
Affects Version/s: 3.1.3
Fix Version/s: None

Time Tracking:
Not Specified


 Description  « Hide
Suppose this function in a published module :

def index(req)
    req.content_type = 'text/plain'
    yield '1\n'
    yield '2\n'
    yield '3\n'
    yield '4\n'

When published, this module should return a text content with '1\n2\n3\n4\n'.

This could also be useful with a file() object, since they are iterable ; this would provide another way to send a file, only slightly less performing than the send_file() method. Handy when you want to filter a file :

def filter(req,filename):
    f = open(filename,'r')
    for line in f:
        yield re.sub('foo','bar',line)


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Nicolas Lehuen made changes - 01/May/05 07:28 PM
Field Original Value New Value
Status Open [ 1 ] In Progress [ 3 ]
Nicolas Lehuen made changes - 26/Jun/05 07:19 AM
Fix Version/s 3.2.0 [ 11060 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Nicolas Lehuen made changes - 10/Dec/05 06:16 PM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
Nicolas Lehuen made changes - 10/Dec/05 06:18 PM
Fix Version/s 3.3 [ 12310101 ]
Environment
Fix Version/s 3.2 [ 11060 ]
Description Suppose this function in a published module :

def index(req)
    req.content_type = 'text/plain'
    yield '1\n'
    yield '2\n'
    yield '3\n'
    yield '4\n'

When published, this module should return a text content with '1\n2\n3\n4\n'.

This could also be useful with a file() object, since they are iterable ; this would provide another way to send a file, only slightly less performing than the send_file() method. Handy when you want to filter a file :

def filter(req,filename):
    f = open(filename,'r')
    for line in f:
        yield re.sub('foo','bar',line)
Suppose this function in a published module :

def index(req)
    req.content_type = 'text/plain'
    yield '1\n'
    yield '2\n'
    yield '3\n'
    yield '4\n'

When published, this module should return a text content with '1\n2\n3\n4\n'.

This could also be useful with a file() object, since they are iterable ; this would provide another way to send a file, only slightly less performing than the send_file() method. Handy when you want to filter a file :

def filter(req,filename):
    f = open(filename,'r')
    for line in f:
        yield re.sub('foo','bar',line)
Graham Dumpleton made changes - 13/Aug/06 07:49 AM
Fix Version/s 3.3 [ 12310101 ]