Re: [Zope-dev] moment when zope was started.
Victor Safronovich wrote: _afterValidateHook do many thinks specific to the portal such as 1. Sets response charset according to the user's selected language. Why not just do this is a normal traversal hook such as an access rule? 2. Replaces HTML-encoded entities with their corresponding characters in the POST form data. Incomign POST form data? Why not just munge the data when you get it from the request in your application? 3. Changes system locale according to the portal language. Can be done in an access rule... Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] moment when zope was started.
Victor Safronovich wrote: My Product wants to replace zpublisher_validate_hook in Zope2.__init__. Why on earth would you want to do that?! Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] moment when zope was started.
Victor Safronovich schrieb: Hello Chris Withers, Tuesday, November 8, 2005, 1:26:29 PM, you wrote: CW Why on earth would you want to do that?! :) my product needs to do some specific things, right after the user is authenticated and becomes known. hook is hook and it may be overloaded as with zpublisher_exception_hook. You might want to look at userfolder implementation, for example PAS. ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] moment when zope was started.
Victor Safronovich schrieb: Hello Tino Wildenhain, Tuesday, November 8, 2005, 4:29:39 PM, you wrote: TW You might want to look at userfolder implementation, for example PAS. Thank you, i look at it, but this is another story ;). Now you should tell us what you are really doing here :-) ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] moment when zope was started.
Victor Safronovich wrote: But in Zope 2.8 the variable 'Zope2.Startup.started' not changed its value to True, because Zope2.Startup.start_zope was never called, instead of that called Zope2.Startup.run.run function. This sounds like a bug, but why do you want to know this? Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] moment when zope was started.
VSHow could i find the moment when zope was started in Zope 2.8? VSin Zope 2.7 was the variable 'Zope.Startup.started', which setted to True when VSzope was started. VSBut in Zope 2.8 the variable 'Zope2.Startup.started' not changed its value to VSTrue, because Zope2.Startup.start_zope was never called, instead of that called VSZope2.Startup.run.run function. this may be fixed like in attachment. -- Best regards, Victor Safronovich NauMen.NauDoc.SoftwareDeveloper http://www.naumen.ruIndex: __init__.py === --- __init__.py (revision 39858) +++ __init__.py (working copy) @@ -28,13 +28,17 @@ logger = logging.getLogger(Zope) started = False +starter = None def get_starter(): -check_python_version() -if sys.platform[:3].lower() == win: -return WindowsZopeStarter() -else: -return UnixZopeStarter() +global starter +if starter is None: +check_python_version() +if sys.platform[:3].lower() == win: +starter = WindowsZopeStarter() +else: +starter = UnixZopeStarter() +return starter def start_zope(cfg, debug_handler): The function called by run.py which starts a Zope appserver. @@ -47,11 +51,11 @@ starter.setConfiguration(cfg) starter.prepare() -started = True +starter.start() try: starter.run() finally: -started = False +starter.finish() class ZopeStarter: @@ -59,6 +63,8 @@ Making it a class makes it easier to test. +started = False + def __init__(self): self.event_logger = logging.getLogger() # We log events to the root logger, which is backed by a @@ -81,6 +87,14 @@ def setConfiguration(self, cfg): self.cfg = cfg +def start(self): +global started +self.started = started = True + +def finish(self) +global started +self.started = started = False + def prepare(self): self.setupInitialLogging() self.setupLocale() Index: run.py === --- run.py (revision 39858) +++ run.py (working copy) @@ -15,11 +15,7 @@ def run(): Start a Zope instance import Zope2.Startup -starter = Zope2.Startup.get_starter() -opts = _setconfig() -starter.setConfiguration(opts.configroot) -starter.prepare() -starter.run() +Zope2.Startup.start_zope(_setconfig().configroot, None) def configure(configfile): Provide an API which allows scripts like zopectl to configure ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )