[Geoserver-devel] More on python scripts and default values

Hi,
the default value treatment for python scripts is now using the default
specified in the execute method signature, e.g.;

def execute(a, b=10)

There is however a catch, what if we wanted to give a a default value,
and not b? Python syntax apparently forces one to put arguments
with a certain default value last, but the meaningful order of inputs
in a process might suggest us a different order.

So, would you mind if we also add a default option, in parallel
to checking the method default values?
Basically the process writer would have two ways to specify
a default, the python way, or the metadata “default” value,
with the latter taking precedence if both are defined.

Cheers
Andrea

==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


I wonder if this is really necessary. This is a well known aspect of the python language and it doesn’t seem unreasonable to have the limitation that any parameter with a default value would have to be ordered after one without a default value? Actually it seems pretty logical to me to order the parameters in that way.

···

On Wed, May 28, 2014 at 7:45 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

Hi,
the default value treatment for python scripts is now using the default
specified in the execute method signature, e.g.;

def execute(a, b=10)

There is however a catch, what if we wanted to give a a default value,
and not b? Python syntax apparently forces one to put arguments
with a certain default value last, but the meaningful order of inputs
in a process might suggest us a different order.

So, would you mind if we also add a default option, in parallel
to checking the method default values?
Basically the process writer would have two ways to specify
a default, the python way, or the metadata “default” value,
with the latter taking precedence if both are defined.

Cheers
Andrea

==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it



Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet


Geoserver-devel mailing list
Geoserver-devel@anonymised.comt
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Justin Deoliveira
Vice President, Engineering | Boundless
jdeolive@anonymised.com
@j_deolive