Skip to content. | Skip to navigation

Navigation

You are here: Home / Support / Guides / Tools / Plone / Adding Plone Pages Remotely / Wrapping Up

Personal tools

Adding Plone Pages Remotely

Wrapping Up

As noted before, adding an External Method to Plone is very easy.

The Python Code

Actually, this bit is slightly less obvious. The documentation says to find the Extensions folder in your Zope distribution (or create it if required) and put the Python code there. Which is fair enough.

Source Products

That does seem a bit non-portable in the sense that if you switch to another version of Plone you've got another place to remember to copy from.

If you've already got an existing source product and you're manipulating it via buildout then you can create an Extensions folder in there and have buildout do all the heavy lifting for you. You won't forget to copy your source product to the new Plone so you'll kill two birds with one stone.

Except buildout doesn't appear to copy the Extensions folder (with Plone 3.3.5). Instead, you might have to manually copy your source code to .../zeocluster/parts/client{1,2}/Extensions which is a bit of a bore.

Creating the External Method

This bit really is as easy as it says:

  1. go to the ZMI
  2. navigate to the /news folder
  3. select Add External Method from the pulldown menu with a zillion options
  1. id should be how you want to access this code in the URL, eg. auto_news
  2. module should be the name of the Python source file without the .py
  3. function should be the name of the function that will be invoked, in this example, news_update

Calling the External Method

Logged into the Plone UI you should be able to invoke like: http://www.example.com/news/auto_news which in turn should complain "No news identifier passed".

http://www.example.com/news/auto_news?news_id=12345 should complain that "News article doesn't exist"

From the Command Line

Finally, you should be able to do the same from the command line with curl, say:

curl -u user:pass http://www.example.com/news/auto_news?sms=12345

and away you go.

Document Actions