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/01/30 01:54:17 UTC
[jira] Commented: (MODPYTHON-16) Publisher : classes could be published
[ http://issues.apache.org/jira/browse/MODPYTHON-16?page=comments#action_58273 ]
Graham Dumpleton commented on MODPYTHON-16:
-------------------------------------------
Doing this would require a special case check. At the moment the fact that a class is callable takes precedence and so all it does is create the object. To be able to convert that then back to a string requires an extra step.
> Publisher : classes could be published
> --------------------------------------
>
> Key: MODPYTHON-16
> URL: http://issues.apache.org/jira/browse/MODPYTHON-16
> Project: mod_python
> Type: Improvement
> Versions: 3.1.3
> Reporter: Nicolas Lehuen
> Priority: Minor
>
> Suppose this in a published Module :
> class index(object):
> def __init__(self,req,name):
> self.buffer ='<html><body><p>Hello, %s !</p></body></html>'%name
>
> def __str__(self):
> return self.buffer
> The publisher could notice that the index object is in fact a class, instantiate it and write the result of a str() conversion to the client.
> Why should we do this ?
> 1) we can ;)
> 2) this could be done by a class definition + a index function which does the job, but this way, we save a function definition.
--
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