Permalink
Browse files

Move the app initialization into get_startup_cmd since both consumers…

… do it.
  • Loading branch information...
1 parent d6b6f41 commit 2288efca49d37e09b3a3bac4f0d1e512f20ed9b6 @rpatterson rpatterson committed Apr 10, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/plone/recipe/zope2instance/ctl.py
@@ -392,8 +392,9 @@ def get_startup_cmd(self, python, more, pyflags=""):
# Also, don't forget that 'python'
# may have spaces and needs to be quoted.
cmdline = ('"%s" %s -c "from Zope2 import configure; '
- 'configure(r\'%s\'); ' %
- (python, pyflags, self.options.configfile))
+ 'configure(r\'%s\'); '
+ 'import Zope2; app=Zope2.app(); '
+ % (python, pyflags, self.options.configfile))
cmdline = cmdline + more + '\"'
if zopectl.WIN:
# entire command line must be quoted
@@ -436,7 +437,7 @@ def do_run(self, arg):
if len(tup) > 1:
argv = tup[1:]
cmd += '[sys.argv.append(x) for x in %s]; ' % argv
- cmd += 'import Zope2; app=Zope2.app(); execfile(r\'%s\')' % script
+ cmd += 'execfile(r\'%s\')' % script
cmdline = self.get_startup_cmd(self.options.python, cmd)
self._exitstatus = os.system(cmdline)
@@ -449,8 +450,7 @@ def help_console(self):
print " In contrast to foreground this does not turn on debug mode."
def do_debug(self, arg):
- cmdline = self.get_startup_cmd(self.options.python,
- 'import Zope2; app=Zope2.app()',
+ cmdline = self.get_startup_cmd(self.options.python, '',
pyflags = '-i', )
print ('Starting debugger (the name "app" is bound to the top-level '
'Zope object)')

0 comments on commit 2288efc

Please sign in to comment.