[Zope] Re: Cron & Receiving email
by Chris McDonough other posts by this author
May 16 2001 1:58PM messages near this date
Re: [Zope] Cron & Receiving email
|
[Zope] Re: Cron & Receiving email
> 1) Is there a cron-like tool in Zope? Or a way to have cron
> run a process in Zope?
Zope is completely event-driven, so there's no scheduler built in to it.
There's a product named Xron which provides cron-like functionality within
Zope (I've not used it).
You can also use a Python script (a real one, on disk, having nothing to do
with Zope) that calls a Zope method via HTTP or XML-RPC. Attached is a
module named XMLRPCBasicAuth.py, which you can use like this:
> >> import XMLRPCBasicAuth
> >> s = XMLRPCBasicAuth.Server('http://www.zope.org','chrism', 'mypassword')
> >> s.Members.chrism.manage_addDocument('foo', 'bar', 'some text')
Note that the library named "xmlrpclib" needs to be somewhere in your
PYTHONPATH (read the source of the XMLRPCBasicAuth.py file to see how to put
it in). Also, you'll likely see things like "ProtocolErrors" and HTML being
returned from XMLRPC method calls. You'll need to experiment with what you
want to to (e.g. use the XMLRPCBasicAuth module to call methods from a
Python prompt, and then take a look at the running Zope via the Zope web
mgmt interface after you've made a call to see if the call has succeeded,
and its results), but for the most part, you can just call methods on Zope
objects like you would if you were at a Python prompt, the two notable
exceptions being:
1. You can't pass keyword arguments.
2. XMLRPC can only marshal certain types, and object instances aren't one
of them.
Combining a Python program that uses XMLRPC with UNIX cron (or WinNT
Scheduler service) allows you to kick off events at scheduled times.
>
> 2) Under Linux/Sendmail, can I have the above Zope process
> "receive" mail sent to a particular address? (Note that my
> ignorance of how mail works could fill volumes).
Not really. If you can expland on what you'd like to accomplish by doing
this, maybe I can help a little better.
- C
Attachments:
XMLRPCBasicAuth.py
Thread:
Bruce Eckel
Oleg Broytmann
Chris McDonough
Chris Beaumont
Bruce Eckel
Loren Stafford
|