You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by "Graham Dumpleton (JIRA)" <ji...@apache.org> on 2005/02/13 02:55:12 UTC

[jira] Commented: (MODPYTHON-15) Publisher : iterable return values should be corretly published

     [ http://issues.apache.org/jira/browse/MODPYTHON-15?page=comments#action_59103 ]
     
Graham Dumpleton commented on MODPYTHON-15:
-------------------------------------------

I would be worried here about cases where a generator/iterator of this form never actually had a stop condition. Imagine something which continually generates random numbers (if that makes sense). If mod_python were to just keep calling it to generate all data, it would eventually blow up. Seems to me to be safer for mod_python not to do anything with generators/iterators at all and make the user wrap them as appropriate to extract all the required data.

Note, I could be talking nonsense here as I have never consciously used generators so making some assumptions about them. :-)

> Publisher : iterable return values should be corretly published
> ---------------------------------------------------------------
>
>          Key: MODPYTHON-15
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-15
>      Project: mod_python
>         Type: Improvement
>     Versions: 3.1.3
>     Reporter: Nicolas Lehuen
>     Assignee: Nicolas Lehuen
>     Priority: Minor

>
> 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)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira