Commit f9cea257 authored by 's avatar

- use getConfiguration() instead of Globals

parent df9937c4
...@@ -7,12 +7,11 @@ ...@@ -7,12 +7,11 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""Image object that is stored in a file""" """Image object that is stored in a file"""
import os
import os.path import os.path
import stat import stat
import time import time
...@@ -47,7 +46,6 @@ class ImageFile(Explicit): ...@@ -47,7 +46,6 @@ class ImageFile(Explicit):
security = ClassSecurityInfo() security = ClassSecurityInfo()
def __init__(self, path, _prefix=None): def __init__(self, path, _prefix=None):
import Globals # for data
if _prefix is None: if _prefix is None:
_prefix=getattr(getConfiguration(), 'softwarehome', None) or PREFIX _prefix=getattr(getConfiguration(), 'softwarehome', None) or PREFIX
if not os.path.isabs(path): if not os.path.isabs(path):
...@@ -57,7 +55,7 @@ class ImageFile(Explicit): ...@@ -57,7 +55,7 @@ class ImageFile(Explicit):
# _prefix is ignored if path is absolute # _prefix is ignored if path is absolute
path = os.path.join(_prefix, path) path = os.path.join(_prefix, path)
self.path=path self.path=path
if Globals.DevelopmentMode: if getConfiguration().debug_mode:
# In development mode, a shorter time is handy # In development mode, a shorter time is handy
max_age = 60 # One minute max_age = 60 # One minute
else: else:
......
...@@ -7,15 +7,20 @@ ...@@ -7,15 +7,20 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
import DocumentTemplate, Common, Persistence, MethodObject, Globals, os, sys import os
from types import InstanceType import sys
from logging import getLogger from logging import getLogger
from App.config import getConfiguration from types import InstanceType
import DocumentTemplate
import MethodObject
import Persistence
from App import Common
from App.config import getConfiguration
LOG = getLogger('special_dtml') LOG = getLogger('special_dtml')
...@@ -49,7 +54,7 @@ class ClassicHTMLFile(DocumentTemplate.HTMLFile,MethodObject.Method,): ...@@ -49,7 +54,7 @@ class ClassicHTMLFile(DocumentTemplate.HTMLFile,MethodObject.Method,):
apply(ClassicHTMLFile.inheritedAttribute('__init__'), args, kw) apply(ClassicHTMLFile.inheritedAttribute('__init__'), args, kw)
def _cook_check(self): def _cook_check(self):
if Globals.DevelopmentMode: if getConfiguration().debug_mode:
__traceback_info__=self.raw __traceback_info__=self.raw
try: mtime=os.stat(self.raw)[8] try: mtime=os.stat(self.raw)[8]
except: mtime=0 except: mtime=0
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
import os import os
...@@ -17,6 +17,7 @@ from AccessControl.Permissions import access_contents_information ...@@ -17,6 +17,7 @@ from AccessControl.Permissions import access_contents_information
from AccessControl.Permissions import view as View from AccessControl.Permissions import view as View
from AccessControl.SecurityInfo import ClassSecurityInfo from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import Implicit from Acquisition import Implicit
from App.config import getConfiguration
from App.ImageFile import ImageFile from App.ImageFile import ImageFile
from App.special_dtml import DTMLFile from App.special_dtml import DTMLFile
from App.special_dtml import HTML from App.special_dtml import HTML
...@@ -26,6 +27,7 @@ from OFS.PropertyManager import PropertyManager ...@@ -26,6 +27,7 @@ from OFS.PropertyManager import PropertyManager
from OFS.SimpleItem import Item from OFS.SimpleItem import Item
from Persistence import Persistent from Persistence import Persistent
class HelpTopicBase: class HelpTopicBase:
"Mix-in Help Topic support class" "Mix-in Help Topic support class"
...@@ -133,8 +135,7 @@ class HelpTopic(Implicit, HelpTopicBase, Item, PropertyManager, Persistent): ...@@ -133,8 +135,7 @@ class HelpTopic(Implicit, HelpTopicBase, Item, PropertyManager, Persistent):
self._v_last_read = mtime self._v_last_read = mtime
def _check_for_update(self): def _check_for_update(self):
import Globals if getConfiguration().debug_mode:
if Globals.DevelopmentMode:
try: mtime=os.stat(self.file)[8] try: mtime=os.stat(self.file)[8]
except: mtime=0 except: mtime=0
if mtime != self._v_last_read: if mtime != self._v_last_read:
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
...@@ -17,18 +17,16 @@ from logging import getLogger ...@@ -17,18 +17,16 @@ from logging import getLogger
from AccessControl.class_init import InitializeClass from AccessControl.class_init import InitializeClass
from AccessControl.SecurityInfo import ClassSecurityInfo from AccessControl.SecurityInfo import ClassSecurityInfo
from AccessControl.SecurityManagement import getSecurityManager from AccessControl.SecurityManagement import getSecurityManager
from Acquisition import aq_parent, aq_inner, aq_get
from App.Common import package_home from App.Common import package_home
from App.special_dtml import DTMLFile
from App.config import getConfiguration from App.config import getConfiguration
from Acquisition import aq_parent, aq_inner, aq_get
from ComputedAttribute import ComputedAttribute from ComputedAttribute import ComputedAttribute
from OFS.SimpleItem import SimpleItem from OFS.SimpleItem import SimpleItem
from OFS.Traversable import Traversable from OFS.Traversable import Traversable
from Shared.DC.Scripts.Script import Script
from Shared.DC.Scripts.Signature import FuncCode
from Products.PageTemplates.Expressions import SecureModuleImporter from Products.PageTemplates.Expressions import SecureModuleImporter
from Products.PageTemplates.PageTemplate import PageTemplate from Products.PageTemplates.PageTemplate import PageTemplate
from Shared.DC.Scripts.Script import Script
from Shared.DC.Scripts.Signature import FuncCode
from zope.contenttype import guess_content_type from zope.contenttype import guess_content_type
from zope.pagetemplate.pagetemplatefile import sniff_type from zope.pagetemplate.pagetemplatefile import sniff_type
...@@ -140,8 +138,7 @@ class PageTemplateFile(SimpleItem, Script, PageTemplate, Traversable): ...@@ -140,8 +138,7 @@ class PageTemplateFile(SimpleItem, Script, PageTemplate, Traversable):
return self.__name__ # Don't reveal filesystem paths return self.__name__ # Don't reveal filesystem paths
def _cook_check(self): def _cook_check(self):
import Globals # for data if self._v_last_read and not getConfiguration().debug_mode:
if self._v_last_read and not Globals.DevelopmentMode:
return return
__traceback_info__ = self.filename __traceback_info__ = self.filename
try: try:
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
"""XML-RPC support module """XML-RPC support module
...@@ -24,11 +24,10 @@ import sys ...@@ -24,11 +24,10 @@ import sys
import types import types
import xmlrpclib import xmlrpclib
from App.config import getConfiguration
from zExceptions import Unauthorized from zExceptions import Unauthorized
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from ZPublisher.HTTPResponse import HTTPResponse
# Make DateTime.DateTime marshallable via XML-RPC # Make DateTime.DateTime marshallable via XML-RPC
# http://www.zope.org/Collectors/Zope/2109 # http://www.zope.org/Collectors/Zope/2109
from DateTime.DateTime import DateTime from DateTime.DateTime import DateTime
...@@ -168,8 +167,7 @@ class Response: ...@@ -168,8 +167,7 @@ class Response:
remove = [r"<[^<>]*>", r"&[A-Za-z]+;"] remove = [r"<[^<>]*>", r"&[A-Za-z]+;"]
for pat in remove: for pat in remove:
vstr = re.sub(pat, " ", vstr) vstr = re.sub(pat, " ", vstr)
import Globals # for data if getConfiguration().debug_mode:
if Globals.DevelopmentMode:
from traceback import format_exception from traceback import format_exception
value = '\n' + ''.join(format_exception(t, vstr, tb)) value = '\n' + ''.join(format_exception(t, vstr, tb))
else: else:
......
...@@ -13,11 +13,19 @@ ...@@ -13,11 +13,19 @@
"""Initialize the Zope2 Package and provide a published module """Initialize the Zope2 Package and provide a published module
""" """
from zope.component import queryMultiAdapter import imp
from zope.event import notify import logging
from zope.processlifetime import DatabaseOpened import sys
from zope.processlifetime import DatabaseOpenedWithRoot from time import asctime
import AccessControl.User
import App.ZApplication
import ExtensionClass
import OFS.Application
import transaction
import ZODB
import Zope2
import ZPublisher
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager from AccessControl.SecurityManagement import noSecurityManager
from Acquisition import aq_acquire from Acquisition import aq_acquire
...@@ -26,21 +34,13 @@ from Acquisition import aq_inner ...@@ -26,21 +34,13 @@ from Acquisition import aq_inner
from Acquisition import aq_parent from Acquisition import aq_parent
from Acquisition.interfaces import IAcquirer from Acquisition.interfaces import IAcquirer
from App.config import getConfiguration from App.config import getConfiguration
from time import asctime
from zExceptions import Redirect from zExceptions import Redirect
from zExceptions import Unauthorized from zExceptions import Unauthorized
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
import transaction from zope.component import queryMultiAdapter
import AccessControl.User from zope.event import notify
import ExtensionClass from zope.processlifetime import DatabaseOpened
import imp from zope.processlifetime import DatabaseOpenedWithRoot
import logging
import OFS.Application
import sys
import ZODB
import App.ZApplication
import Zope2
import ZPublisher
app = None app = None
startup_time = asctime() startup_time = asctime()
...@@ -127,7 +127,7 @@ def startup(): ...@@ -127,7 +127,7 @@ def startup():
# Initialize the app object # Initialize the app object
application = app() application = app()
OFS.Application.initialize(application) OFS.Application.initialize(application)
if Globals.DevelopmentMode: if getConfiguration().debug_mode:
# Set up auto-refresh. # Set up auto-refresh.
from App.RefreshFuncs import setupAutoRefresh from App.RefreshFuncs import setupAutoRefresh
setupAutoRefresh(application._p_jar) setupAutoRefresh(application._p_jar)
......
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
"""ZCML machinery """ZCML machinery
""" """
import os
import os.path import os.path
from App.config import getConfiguration
from zope.configuration import xmlconfig from zope.configuration import xmlconfig
_initialized = False _initialized = False
...@@ -30,11 +31,9 @@ def load_site(force=False): ...@@ -30,11 +31,9 @@ def load_site(force=False):
return return
_initialized = True _initialized = True
import Globals
Globals.INSTANCE_HOME
# load instance site configuration file # load instance site configuration file
site_zcml = os.path.join(Globals.INSTANCE_HOME, "etc", "site.zcml") instancehome = getConfiguration().instancehome
site_zcml = os.path.join(instancehome, "etc", "site.zcml")
if not os.path.exists(site_zcml): if not os.path.exists(site_zcml):
# check for zope installation home skel during running unit tests # check for zope installation home skel during running unit tests
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment