Using the monitor_client
When using the monitor_client, I do this: -- Start monitor_client usage python monitor_client.py localhost 8099 Enter Password: warning: unhandled connect event Python 1.5.2 (#1, Mar 11 2000, 13:03:53) [GCC 2.95.2 19991024 (release)] Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam Welcome to <secure_monitor_channel connected 127.0.0.1:2959 at 88fbf80>
import Zope app=Zope.app() app.addDTMLMethod Traceback (innermost last): File "/usr/local/Zope/ZServer/medusa/monitor.py", line 94, in found_terminator result = eval (co, self.local_env) File "<secure_monitor_channel connected 127.0.0.1:2959 at 88fbf80>", line 0, in ? AttributeError: addDTMLMethod app.manage_addDTMLMEthod Traceback (innermost last): File "/usr/local/Zope/ZServer/medusa/monitor.py", line 94, in found_terminator result = eval (co, self.local_env) File "<secure_monitor_channel connected 127.0.0.1:2959 at 88fbf80>", line 0, in ? AttributeError: manage_addDTMLMEthod app.manage_addDTMLMethod <Python Method object at 82ee058> app.manage_addDTMLMethod('tester','tester','tester') '' app._p_jar.sync() get_transaction().commit() warning: unhandled close event
closed. morten@slakka:/usr/local/Zope/ZServer/medusa > -- End monitor_client usage However, when I enter the management screen of the Zope instance, no DTMLMethod called tester is listed.. (I used http://www.zope.org/Documentation/Misc/DEBUGGING.txt as a guide..) Can anyone see what I'm doing wrong? Thanks in advance. -Morten
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
[Yves-Eric Martin] | - Zope.app() gives you a *copy* of the *real* application object. | - app._p_jar.sync() reloads your copy with the real (losing your changes) Ah, there it is; sync discards the changes made from the monitor, and then reloads... An extra thanks for the thorough (not-very-newbie-like) explanation, much appreciated! =) -Morten
Yves-Eric Martin wrote:
I am no Zope monitor expert, but maybe you will find my newbie point
For some definition of newbie... :-)
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)
I didn't realize sync() was there. Thanks for the tip! Shane
participants (3)
-
morten@esol.no -
Shane Hathaway -
Yves-Eric Martin