[Zope-dev] Using the monitor_client

Yves-Eric Martin yemartin@garage.co.jp
Tue, 31 Oct 2000 22:38:02 +0900


    Hello,

    I am no Zope monitor expert, but maybe you will find my newbie point
of view helpful. Here is my understanding of the magic of this very
helpful tool:

- Zope.app() gives you a *copy* of the *real* application object.
- app._p_jar.sync() reloads your copy with the real (losing your changes)
- get_transaction().commit() writes your copy to the real (applying your
    changes)

    So what you want to do here is the latter. I tried the following and
it seems to work:

	python monitor_client.py localhost 8099
	Enter Password:
	warning: unhandled connect event
	Python 1.5.2 (#0, Apr  3 2000, 14:46:48)  [GCC 2.95.2 20000313 (Debian GNU/Linux)]
	Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
	Welcome to <secure_monitor_channel connected 127.0.0.1:1778 at 85a80f8>
	>>> import Zope, OFS
	>>> app=Zope.app()
	>>> newMethod = OFS.DTMLMethod.DTMLMethod('', __name__='theZopeMonitorIsCool')
	>>> app._setObject('theZopeMonitorIsCool', newMethod)
	'theZopeMonitorIsCool'
	>>> get_transaction().commit()
	>>> app._p_jar.close()


Hope this helps...


Cheers,

-- 
Yves-Eric Martin
Digital Garage Inc.
yemartin@garage.co.jp