WebFaction
Community site: login faq

Hi folks,

I'm trying to add and external method to a Zope site. I've created an Extensions directory under zinstance and put a file named example.py there. The example.py file just has

def hello(self):
    return "Hello World!"

When I try to add the External Method I get a message:

Site Error

An error was encountered while publishing this resource.

Error Type: NotFound
Error Value: The specified module, 'example', couldn't be found

I've tried restarting Zope, that didn't help.

I'm wondering what kind of dumb mistake I'm making.

Thanks for your advice.

asked 10 Apr '12, 17:05

squareup
1626
accept rate: 50%

edited 10 Apr '12, 20:42


External methods need to be in a directory named "Extensions" inside of a product directory. Try running the following commands from your zinstance directory:

mkdir -p products/Examples/Extensions
touch products/Examples/__init__.py
cp Examples/example.py products/Examples/Extensions/
./bin/instance restart

Then create an external method like this after Zope has restarted:

  • id: whatever
  • title: optional
  • Module name: Examples.example
  • Function name: hello

You should then be able to test the external method via the Test tab in the ZMI.


permanent link

answered 10 Apr '12, 20:01

seanf
12.2k41836
accept rate: 37%

edited 11 Apr '12, 09:00

No joy, same result after creating the init.py I did see that init.pyc was created though.

(10 Apr '12, 22:54) squareup

I've added some extra steps for creating the external method object in Zope - can you please try again?

(11 Apr '12, 09:00) seanf

Will do later today.

(11 Apr '12, 11:26) squareup

It worked, no error message and it shows up in ZMI. Thanks!

(11 Apr '12, 13:33) squareup

You're very welcome, glad I could help :)

(11 Apr '12, 13:34) seanf
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×108
×18
×7
×2
×2

question asked: 10 Apr '12, 17:05

question was seen: 3,111 times

last updated: 11 Apr '12, 13:34

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM