[Qgis-developer] QEP: QGIS Mapserver Python Plugins

Alessandro Pasotti apasotti at gmail.com
Thu Aug 28 05:49:47 PDT 2014


Hello,

as anticipated to some of you during the last HF, I've started to add
Python plugins support for the server side.

The rationale behind server plugins is doublefold: first they could
provide additional services without the need to touch the C++
codebase, second they allow for GUI-based configuration since the
server plugins are not separated from the desktop plugins (of course
the environment and permissions should be carefully configured to
allow information sharing from the desktop user to the webserver user
).

I've already coded a first working implementation and a few
proof-of-concept plugins.

The current implementation is based on the following ideas:

QGIS Python plugins can have additional metatags to specify what
SERVICE and REQUEST they expose, for example:

service=HELLO
methods=GetCapabilities,GetOutput,RemoteConsole

This plugin will respond to calls like
/cgi-bin/qgis_mapserv.fcgi?SERVICE=HELLO&REQUEST=RemoteConsole


The current implementation is pretty simple and CGI-style, whatever
the plugin prints to sdtout is captured and sent back to the client,
the return value from the method is the (optional) content type.

I would like to discuss this ideas during the next HF (or sooner), in
particular:

* I'm not happy with the current request handling and I think we need
a mehod to pass cached parsed project instances to the plugins when
needed and a better handling of HTTP headers
* I 'd like to see signals/slots implementation instead of static
function calls, but maybe it's just syntactic sugar
* from the python side, we don't have an iface to pass to the plugins,
so I'm currently stuck to @staticmethod


The code is in a branch:
https://github.com/elpaso/QGIS/tree/serverplugins

HelloServer demo plugin:
https://github.com/elpaso/qgis-helloserver
It is a test plugin and it provides a remote console (web shell),
insanely insecure DO NOT USE IN PRODUCTION!! and arbitrary python code
execution configurable through the QGIS desktop plugin GUI.

Here is a short demo of the HelloServer plugin:
http://youtu.be/ys9VVxQ8uac

Have fun !!


-- 
Alessandro Pasotti
w3:   www.itopen.it


More information about the Qgis-developer mailing list