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 "Nicolas Lehuen (JIRA)" <ji...@apache.org> on 2005/01/29 14:01:17 UTC
[jira] Created: (MODPYTHON-16) Publisher : classes could be published
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
Re: [jira] Created: (MODPYTHON-16) Publisher : classes could be published
Posted by Nicolas Lehuen <ni...@gmail.com>.
On Sun, 30 Jan 2005 10:43:57 -0500, Daniel Popowich
<dp...@comcast.net> wrote:
>
> Nicolas Lehuen (JIRA) writes:
> > 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.
> >
>
> Hmmm...instantiate an object representing the request and call methods
> on the instance to generate the response...hmmm...sounds like
> mpservlets!!
>
> Daniel Popowich
> -----------------------------------------------
> http://home.comcast.net/~d.popowich/mpservlets/
>
>
Indeed... I don't know how you feel about that, Daniel, but I really
think it's possible to implement a multi-layered publishing system :
mod_python basics --> mod_python.publisher -> mpservlets
With mpservlets being a set of classes published by the
mod_python.publisher. Of course, this means fixing a lot of stuff
(especially all the problems about module loading).
We would keep mod_python.publisher as the basic module loading system,
which knows how to locate and load modules, traverse the URI until it
finds an object to handle the request. mod_python.publisher should
handle basic concurrency problems (especially multithreading support),
basic security problems (what is traversable and publishable), but
should stop there.
With mod_python.publisher, a lot of objects could be published :
function, callable instances, methods and so on. The problem is that a
user could be lost amongst all the possibilites. That's were a higher
level framework like mpservlets enters : it define a common page
composition framework for an application. mpservlet being adapted on
top of the mod_python.publisher, nothing would prevent the developer
to mix and match lower level approaches or other publishers, according
to its needs.
What do you think about that ?
Regards,
Nicolas
On top of the publisher, we could stack higher level publishing
frameworks, like mpservlets or other ones.
Re: [jira] Created: (MODPYTHON-16) Publisher : classes could be published
Posted by Daniel Popowich <dp...@comcast.net>.
Nicolas Lehuen (JIRA) writes:
> 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.
>
Hmmm...instantiate an object representing the request and call methods
on the instance to generate the response...hmmm...sounds like
mpservlets!!
Daniel Popowich
-----------------------------------------------
http://home.comcast.net/~d.popowich/mpservlets/
[jira] Assigned: (MODPYTHON-16) Publisher : classes could be published
Posted by "Nicolas Lehuen (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/MODPYTHON-16?page=all ]
Nicolas Lehuen reassigned MODPYTHON-16:
---------------------------------------
Assign To: Nicolas Lehuen
> 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
> Assignee: 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
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Work started: (MODPYTHON-16) Publisher : classes could be published
Posted by "Nicolas Lehuen (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/MODPYTHON-16?page=all ]
Work on MODPYTHON-16 started by Nicolas Lehuen
> 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
> Assignee: 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
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Updated: (MODPYTHON-16) Publisher : classes could be published
Posted by "Nicolas Lehuen (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/MODPYTHON-16?page=all ]
Nicolas Lehuen updated MODPYTHON-16:
------------------------------------
Component: publisher
> Publisher : classes could be published
> --------------------------------------
>
> Key: MODPYTHON-16
> URL: http://issues.apache.org/jira/browse/MODPYTHON-16
> Project: mod_python
> Type: Improvement
> Components: publisher
> Versions: 3.1.3
> Reporter: Nicolas Lehuen
> Assignee: 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
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (MODPYTHON-16) Publisher : classes could be published
Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
[ 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
[jira] Work stopped: (MODPYTHON-16) Publisher : classes could be published
Posted by "Nicolas Lehuen (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/MODPYTHON-16?page=all ]
Work on MODPYTHON-16 stopped by Nicolas Lehuen
> Publisher : classes could be published
> --------------------------------------
>
> Key: MODPYTHON-16
> URL: http://issues.apache.org/jira/browse/MODPYTHON-16
> Project: mod_python
> Type: Improvement
> Components: publisher
> Versions: 3.1.3
> Reporter: Nicolas Lehuen
> Assignee: 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
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (MODPYTHON-16) Publisher : classes could be published
Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/MODPYTHON-16?page=comments#action_58274 ]
Graham Dumpleton commented on MODPYTHON-16:
-------------------------------------------
Whoops. Sorry, current behaviour is not that callable() takes precedence in this case but conversion of class to a string, which is just yielding a name of the class in appropriate module context. Thus apply_fs_data() needs to understand the type which I see you have done. Since all results of callables have to be converted to strings anyway by str(), then yes it would automatically be converted to custom string if __str__() defined. Thus my comments are redundant.
> 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