Michael Haubenwallner wrote:
Philipp von Weitershausen schrieb:
zopeproject makes it easy to get started with a web application based on
Zope eggs, zc.buildout and WSGI/Paste. If you're not familiar with this
world yet, zopeproject is your easy entry to it. If you are, zopeproject
will save you lots of typing up the boilerplate.

Thank you for developing zopeproject, this is very useful.

With zopeproject's approach, *your code* is the application. The web
application, to be precise. And it *happens* to use Zope. As a library::

  +------------+           +-------------+          +---------+
  |WSGI gateway|  serves   |  your code  |   uses   |  Zope   |
  |  (server)  |  ------>  |(application)|   ---->  |libraries|
  +------------+           +-------------+          +---------+

Now for that part - one of my use cases would be to allow XML-RPC access only throughout the app. How would you setup the application with and without security support, disabling all other protocols defined in the publisher and the ZMI altogether ?

The PublicationRequestFactory in z.a.publication decides what to do with an incoming HTTP request. Based on configurable rules, it can instantiate the request type you like.

By default, your application generated with zopeproject includes z.a.zcmlfiles/configure.zcml right at the top of its conigure.zcml. z.a.zcmlfiles/configure.zcml in turn includes z.a.publication/configure.zcml which configures a bunch of default rules, including those for Browser, HTTP/DAV and XMLRPC requests. You'll basically have to disable those if you just want XMLRPC.

How do you do that? First of all, get rid of

  <include package="zope.app.zcmlfiles" />

in your package's configure.zcml. Now you're not getting z.a.publication anymore, but you're obviously missing a lot of other useful stuff which you'll likely have to add to your package's configure.zcml manually. This is a try-and-error procedure; it also depends on how much stuff you actually want. This may take some time trying out, but in the end you're very flexible about what you're loading and what not.

Then, you'll obviously have to add back a rule for the PublicationRequestFactory to instantiate XMLRPC requests. If your app should only ever do XMLRPC, it's simple: configure the rule to always create an XMLRPC request.

Basically, in the end you'll have to do some peeking in z.a.zcmlfiles/configure.zcml and z.a.publication/configure.zcml and selectively copy the stuff you want to your package's configure.zcml.

Btw, if you manage to get it working, please share your results. I'd be interested in whether it's as straight-forward as I'd like it to be with zopeproject...

http://worldcookery.com -- Professional Zope documentation and training
Zope3-users mailing list

Reply via email to