You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bs...@bluedolphin.com on 2001/06/13 22:06:33 UTC
RFC: Python objects in context
Based on the fact that the Turbine project contains a PythonAssembler I
guess that people see how valuable Python can be in terms of rapid
development. Given this what do people think about extending Velocity to
deal with Python objects being placed into the context directly?
I have added support to ASTIdentifier by adding a PythonExecutor that will
try to resolve reference from anything that subclasses PyObject. This is a
pretty clean fit I think and doesn't require much code. I was about to
extend ASTMethod to handle the method case, but here is the thing. I don't
want to create a solid dependency on Jython in the Velocity codebase. What
I would like from people are ideas about how to extend the AbstractExecutor
notion to be more like plugable directive and then extend this notion to
the AST{Identifier, Method, Reference?}
Then these could walk a runtime defined list of Executors and preform the
right handling without needing to link velocity with the handlers codebase.
What do people think? Is this just a custom body of work or should we look
at adding something like this to the main codebase?
Thanks
Ben
Re: RFC: Python objects in context
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Daniel Rall wrote:
>
> "Geir Magnusson Jr." <ge...@optonline.net> writes:
>
> > > I have added support to ASTIdentifier by adding a PythonExecutor that will
> > > try to resolve reference from anything that subclasses PyObject. This is a
> > > pretty clean fit I think and doesn't require much code. I was about to
> > > extend ASTMethod to handle the method case, but here is the thing. I don't
> > > want to create a solid dependency on Jython in the Velocity codebase. What
> > > I would like from people are ideas about how to extend the AbstractExecutor
> > > notion to be more like plugable directive and then extend this notion to
> > > the AST{Identifier, Method, Reference?}
> >
> > If you can do it in the AST, why not just make a conventionally
> > introspectable wrapper class for the python stuff...? Then you can drop
> > that right into the context, and no one is the wiser....
>
> This is definitely the best way to handle this. Your wrapper could go
> into our contrib/optional section.
+1
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
Developing for the web? See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!
Re: RFC: Python objects in context
Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Geir Magnusson Jr." <ge...@optonline.net> writes:
> > I have added support to ASTIdentifier by adding a PythonExecutor that will
> > try to resolve reference from anything that subclasses PyObject. This is a
> > pretty clean fit I think and doesn't require much code. I was about to
> > extend ASTMethod to handle the method case, but here is the thing. I don't
> > want to create a solid dependency on Jython in the Velocity codebase. What
> > I would like from people are ideas about how to extend the AbstractExecutor
> > notion to be more like plugable directive and then extend this notion to
> > the AST{Identifier, Method, Reference?}
>
> If you can do it in the AST, why not just make a conventionally
> introspectable wrapper class for the python stuff...? Then you can drop
> that right into the context, and no one is the wiser....
This is definitely the best way to handle this. Your wrapper could go
into our contrib/optional section.
Re: RFC: Python objects in context
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
bsaller@bluedolphin.com wrote:
>
> Based on the fact that the Turbine project contains a PythonAssembler I
> guess that people see how valuable Python can be in terms of rapid
> development. Given this what do people think about extending Velocity to
> deal with Python objects being placed into the context directly?
Eh... :)
> I have added support to ASTIdentifier by adding a PythonExecutor that will
> try to resolve reference from anything that subclasses PyObject. This is a
> pretty clean fit I think and doesn't require much code. I was about to
> extend ASTMethod to handle the method case, but here is the thing. I don't
> want to create a solid dependency on Jython in the Velocity codebase. What
> I would like from people are ideas about how to extend the AbstractExecutor
> notion to be more like plugable directive and then extend this notion to
> the AST{Identifier, Method, Reference?}
If you can do it in the AST, why not just make a conventionally
introspectable wrapper class for the python stuff...? Then you can drop
that right into the context, and no one is the wiser....
> Then these could walk a runtime defined list of Executors and preform the
> right handling without needing to link velocity with the handlers codebase.
> What do people think? Is this just a custom body of work or should we look
> at adding something like this to the main codebase?
>
> Thanks
> Ben
If you can get away with it at app level, I think you should leave it
there.... My gut is that we don't want to start doing things like this,
especially if you can get away with a simple wrapper.
geir
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
Developing for the web? See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!
Re: RFC: Python objects in context
Posted by Jon Stevens <jo...@latchkey.com>.
on 6/13/01 1:06 PM, "bsaller@bluedolphin.com" <bs...@bluedolphin.com>
wrote:
> Based on the fact that the Turbine project contains a PythonAssembler I
> guess that people see how valuable Python can be in terms of rapid
> development.
Well, at least with regards to the people who checked in that code. :-)
> Given this what do people think about extending Velocity to
> deal with Python objects being placed into the context directly?
>
> I have added support to ASTIdentifier by adding a PythonExecutor that will
> try to resolve reference from anything that subclasses PyObject. This is a
> pretty clean fit I think and doesn't require much code. I was about to
> extend ASTMethod to handle the method case, but here is the thing. I don't
> want to create a solid dependency on Jython in the Velocity codebase. What
> I would like from people are ideas about how to extend the AbstractExecutor
> notion to be more like plugable directive and then extend this notion to
> the AST{Identifier, Method, Reference?}
I'm definitely -1 on a direct dependency.
I'm not real familiar with Jython, but I'm still not even sure why you need
to make any modifications. The Context can take any type of Object.
-jon
Re: RFC: Python objects in context
Posted by Jason van Zyl <jv...@apache.org>.
On 6/13/01 4:06 PM, "bsaller@bluedolphin.com" <bs...@bluedolphin.com>
wrote:
> Based on the fact that the Turbine project contains a PythonAssembler I
> guess that people see how valuable Python can be in terms of rapid
> development. Given this what do people think about extending Velocity to
> deal with Python objects being placed into the context directly?
Absolutely no way.
You can use a way similar to what we do in Turbine, and we did it
without having to change Velocity. Velocity is simple and we hope
to keep it that way.
There has to be a better way to add Python support to your
application without having to alter Velocity.
>
> I have added support to ASTIdentifier by adding a PythonExecutor that will
> try to resolve reference from anything that subclasses PyObject. This is a
> pretty clean fit I think and doesn't require much code. I was about to
> extend ASTMethod to handle the method case, but here is the thing. I don't
> want to create a solid dependency on Jython in the Velocity codebase. What
> I would like from people are ideas about how to extend the AbstractExecutor
> notion to be more like plugable directive and then extend this notion to
> the AST{Identifier, Method, Reference?}
>
>
> Then these could walk a runtime defined list of Executors and preform the
> right handling without needing to link velocity with the handlers codebase.
> What do people think? Is this just a custom body of work or should we look
> at adding something like this to the main codebase?
>
> Thanks
> Ben
--
jvz.
http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons