Hello, there are documents at zope.org that say I can publish an object, say 'billy', and invoke its methods with a url http://my.site/billy/my_method How can I register an object in Zope? I would expect object registration to work like external method registration, and indeed, there is an extension in the contributed code section which introduces 'External Objects' in Zope, but it doesn't work for me. Isn't there a standard way in Zope to do this? Thank you Stefan
At 09:52 AM 1/13/99 +0100, Stefan Willie wrote:
there are documents at zope.org that say I can publish an object, say 'billy', and invoke its methods with a url
http://my.site/billy/my_method
How can I register an object in Zope?
Well, it all depends what you mean by 'Zope'. It's confusing because Zope can refer to either the entire Zope framework or simple the Zope ORB.
From the Zope site: """ Using Zope components separately -- You can use the Zope ORB and other Zope components like templates and the object database separately in your Python programs. You should consult the Technical Introduction to Object Publishing with Zope and the Trinkets Tutorial for perspectives on developing with Zope components. """
These two documents: http://www.zope.org/Documentation/Reference/ObjectPublishingIntro http://www.zope.org/Documentation/Reference/Trinkets describe object publishing in general terms and are not concerned with the Zope framework. They assume that you are publishing your own module with the Zope ORB. (I'll update them to make that assumption more obvious.) In fact, as old BoboHeads know, the Zope framework is just another module which is publishable by the Zope ORB. So to publish your own objects without the Zope framework just set up the Zope ORB to publish your module. There are many ways you can do this, including using PCGI, ZopeHTTPServer, and the new CGI publisher. (Take a look at the ZPublisher release if you want to publish your own modules.) Probably the easiest way is to invoke ZopeHTTPServer on the commandline: ZopeHTTPServer.py path/to/MyModule Now the Zope ORB is publishing your module on the web. If you want to publish your objects within the Zope framework you have more things to consider. If you don't want your objects to have any connection or knowledge of the Zope framework then an external method like so will probably work: import MyModule def myObject: "return my object" return MyModule.myObject If your object needs to communicate with Zope objects then things get trickier. You need to start learning the Zope API and figuring out how to accomplish your goals. If you are doing simple things, sticking with an External Method is a good idea. If you are doing complex things you should consider writing a Zope Product. Hope this helps. -Amos P.S. The ExternalObjects Product was an experiment to see how useful it would be to give simple and arbitrary object publishing facilities to Zope. This project is not being actively pursued, but I haven't given up on the idea yet. If you have trouble with ExternalObjects I'd be glad to try and help, but please remember that ExternalObjects is just an experiment, not an official part of Zope.
participants (2)
-
Amos Latteier -
Stefan Wille