Re: [Zope] Passing parameters to external methods

2000-09-14 Thread Dominic Mitchell

On Wed, Sep 13, 2000 at 11:49:03PM +0200, Andreas Pauley wrote:
> Hi,
> I need to pass some parameters to my external methods.
> 
> I have an external method that looks (somewhat) like this:
> 
> def extAccess(self, accttype_cde):
> return accttype_cde
> 
> In the following dtml code, the following statement (with the SQL
> method) works fine:
> 
> 
>  sqlAccess returned something
> 
> 
> This statement, referencing my external method but using the same syntax
> as with the sql method, gives lots of headaches:
> 
> 
>   The external method returned true
> 
> 
> 
> I get the following error for the above statement:
> Error Type: TypeError
> Error Value: not enough arguments; expected 2, got 0

Try doing:


  The external method returned true


To pass in the namespace of where you're calling from.

-Dom

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] [ANN] Whois Tools for Python & Zope

2000-09-06 Thread Dominic Mitchell

Just a small package that some people may find useful.  When used with
Zope, it creates a  tag that does a whois lookup on a
variable.  For example:





Will result in:


Whois Server Version 1.1

Domain names in the .com, .net, and .org domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

   Domain Name: ZOPE.ORG
   Registrar: NETWORK SOLUTIONS, INC.
   Whois Server: whois.networksolutions.com
   Referral URL: www.networksolutions.com
   Name Server: NS02.CODEIT.COM
   Name Server: NS1.DIGICOOL.COM
   Updated Date: 22-feb-1999


>>> Last update of whois database: Tue, 5 Sep 00 05:04:09 EDT <<<

The Registry database contains ONLY .COM, .NET, .ORG, .EDU domains and
Registrars.


You can also explicitly specify a server to contact.

Download it from:

http://www.zope.org/Members/Dom2/whoistools/

Please let me know if you find it useful or find bugs.

-Dom

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Using crontab instead of rc.d

2000-08-24 Thread Dominic Mitchell

On Thu, Aug 24, 2000 at 09:46:11AM +, Stephan Goeldi wrote:
> >5*   *   *   *   root./start
> >
> >This would start the script every five minutes. Now how do I check if the
> >script is running after it's been started and if it wasn't to restart it
> >again.
> 
> Why don't you write a shell script which
> 
> 1. starts the ./stop script, and
> 2. starts the ./start script
> 
> every 5 minutes? So you don't have to check if Zope runs. It's like a 
> restart.

That would be very intensive on the server.  Imagine if your office file
server was set to reboot every 5 minutes, "just in case".  It's far
better to just check if it's dead and only then restart it.

-Dom

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Using crontab instead of rc.d

2000-08-23 Thread Dominic Mitchell

On Thu, Aug 24, 2000 at 04:05:11AM +1000, George Osvald wrote:
> Hello everyone!
> 
> My ISP where I have my web page, is running freeBSD 4.0. I do not know a lot
> about it. I know how to use crontab to start ZOPE at certain time how ever
> how do I use crontab to check on the script that is already running?
> Starting ZOPE again when it's running produces an error message and I do not
> know if that was a healthy solution.
> 
> to start it I would be using something like:
> 
> 5 *   *   *   *   root./start
> 
> This would start the script every five minutes. Now how do I check if the
> script is running after it's been started and if it wasn't to restart it
> again. Also I was thinking to run ZOPE in DEBUG mode. That way it stays
> attached to the terminal (crontab I guess).
> I know about z2.pid. Nevertheless I find ZOPE down quite often every time
> they do something at the ISP. I asked them what to do and they told me to
> use crontab to check the script and restart it. For some reason they don't
> want me to use rc.d
> If I could guarantee to remove the z2.pid every time ZOPE goes down, I could
> apparently include something like this:
> 
> if [ -x /home/virtuals/account/zope/z2.pid ]
> then
>   // exit(0)
> fi
> 
> 5 *   *   *   *   root./start
> 
> to check if the file is present and if not to run the script. That can't be
> done when ZOPE exits abnormally though.
> 
> Is this setup at all possible?

Not quite.

You don't want to run the start program from cron directly.  What would
be better is to write a small script and call that.  My hint of the day
is that you can use "kill -0 $pid" to test to see whether a pid is
alive.  eg:

if ! kill -0 `cat /home/virtuals/account/zope/z2.pid` ; then
cd /home/virtuals/account/zope ; ./start
fi

However, zope already implements a keepalive facility.  If you look at
the existing Z2.pid file, you'll notice that there are two pids (at
least, there are on my 2.1.6 setup).  And if the child dies, it gets
restarted.  For details, see ~zope/lib/python/zdaemon.py.

All of which means that you probably don't want to bother setting this
up.

-Dom

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] PTK binary distribution?

2000-08-02 Thread Dominic Mitchell

On Wed, Aug 02, 2000 at 01:05:16PM +0200, Jean Jordaan wrote:
> Hi Zopers .. 
> 
> Using PTKSnap.tgz , I find 
> 
>   lib\python\Products\ZPatterns\DynPersist.so
>   lib\python\Products\ZPatterns\DynPersist.o
>   lib\python\Products\ZPatterns\DynPersist.pyd
>   lib\python\Products\ZPatterns\DynPersist.c
> 
> in the archive. This looks just fine for Linux use, but
> I'm on W2K without a C compiler .. does anyone have the
> corresponding .dll (it would be a .dll, wouldn't it?)

The .pyd file is a .dll by another name.

-Dom

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )