/usr/share/pyshared/zope/app/appsetup/debug.py is in python-zope.app.appsetup 3.16.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | ##############################################################################
#
# Copyright (c) 2008 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Debug a Zope Application
$Id: debug.py 113108 2010-06-04 11:53:16Z janwijbrand $
"""
__docformat__ = 'restructuredtext'
from zope.app.publication.zopepublication import ZopePublication
import os
import sys
import zdaemon.zdoptions
import zope.app.appsetup.appsetup
import zope.app.appsetup.product
import zope.event
import zope.processlifetime
def load_options(args=None):
if args is None:
args = sys.argv[1:]
options = zdaemon.zdoptions.ZDOptions()
options.schemadir = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'schema')
options.realize(args)
if options.configroot is None:
options.usage("please specify a configuration file")
options = options.configroot
if options.path:
sys.path[:0] = [os.path.abspath(p) for p in options.path]
return options
def loadApplication(args=None):
options = load_options(args)
zope.app.appsetup.product.setProductConfigurations(
options.product_config)
zope.app.appsetup.config(options.site_definition)
db = zope.app.appsetup.appsetup.multi_database(options.databases)[0][0]
zope.event.notify(zope.processlifetime.DatabaseOpened(db))
return db
def main(args=None):
db = loadApplication(args)
if "PYTHONSTARTUP" in os.environ:
execfile(os.environ["PYTHONSTARTUP"])
sys.modules['__main__'].root = db.open().root()[ZopePublication.root_name]
print 'The application root is known as `root`.'
os.environ["PYTHONINSPECT"] = "true"
if __name__ == '__main__':
main()
|