Permalink
Browse files

- use getConfiguration() instead of Globals

  • Loading branch information...
Unknown committed Mar 7, 2011
1 parent df9937c commit f9cea2575fd763f71ed61451ddaa705d3582b874
View
@@ -7,12 +7,11 @@
# 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
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Image object that is stored in a file"""
import os
import os.path
import stat
import time
@@ -47,7 +46,6 @@ class ImageFile(Explicit):
security = ClassSecurityInfo()
def __init__(self, path, _prefix=None):
import Globals # for data
if _prefix is None:
_prefix=getattr(getConfiguration(), 'softwarehome', None) or PREFIX
if not os.path.isabs(path):
@@ -57,7 +55,7 @@ def __init__(self, path, _prefix=None):
# _prefix is ignored if path is absolute
path = os.path.join(_prefix, path)
self.path=path
if Globals.DevelopmentMode:
if getConfiguration().debug_mode:
# In development mode, a shorter time is handy
max_age = 60 # One minute
else:
View
@@ -7,15 +7,20 @@
# 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
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import DocumentTemplate, Common, Persistence, MethodObject, Globals, os, sys
from types import InstanceType
import os
import sys
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')
@@ -49,7 +54,7 @@ def __init__(self, name, _prefix=None, **kw):
apply(ClassicHTMLFile.inheritedAttribute('__init__'), args, kw)
def _cook_check(self):
if Globals.DevelopmentMode:
if getConfiguration().debug_mode:
__traceback_info__=self.raw
try: mtime=os.stat(self.raw)[8]
except: mtime=0
View
@@ -7,7 +7,7 @@
# 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
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import os
@@ -17,6 +17,7 @@
from AccessControl.Permissions import view as View
from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import Implicit
from App.config import getConfiguration
from App.ImageFile import ImageFile
from App.special_dtml import DTMLFile
from App.special_dtml import HTML
@@ -26,6 +27,7 @@
from OFS.SimpleItem import Item
from Persistence import Persistent
class HelpTopicBase:
"Mix-in Help Topic support class"
@@ -133,8 +135,7 @@ def _set_last_read(self, filepath):
self._v_last_read = mtime
def _check_for_update(self):
import Globals
if Globals.DevelopmentMode:
if getConfiguration().debug_mode:
try: mtime=os.stat(self.file)[8]
except: mtime=0
if mtime != self._v_last_read:
@@ -7,7 +7,7 @@
# 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
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
@@ -17,18 +17,16 @@
from AccessControl.class_init import InitializeClass
from AccessControl.SecurityInfo import ClassSecurityInfo
from AccessControl.SecurityManagement import getSecurityManager
from Acquisition import aq_parent, aq_inner, aq_get
from App.Common import package_home
from App.special_dtml import DTMLFile
from App.config import getConfiguration
from Acquisition import aq_parent, aq_inner, aq_get
from ComputedAttribute import ComputedAttribute
from OFS.SimpleItem import SimpleItem
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.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.pagetemplate.pagetemplatefile import sniff_type
@@ -140,8 +138,7 @@ def pt_source_file(self):
return self.__name__ # Don't reveal filesystem paths
def _cook_check(self):
import Globals # for data
if self._v_last_read and not Globals.DevelopmentMode:
if self._v_last_read and not getConfiguration().debug_mode:
return
__traceback_info__ = self.filename
try:
View
@@ -7,7 +7,7 @@
# 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
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""XML-RPC support module
@@ -24,11 +24,10 @@
import types
import xmlrpclib
from App.config import getConfiguration
from zExceptions import Unauthorized
from ZODB.POSException import ConflictError
from ZPublisher.HTTPResponse import HTTPResponse
# Make DateTime.DateTime marshallable via XML-RPC
# http://www.zope.org/Collectors/Zope/2109
from DateTime.DateTime import DateTime
@@ -168,8 +167,7 @@ def exception(self, fatal=0, info=None,
remove = [r"<[^<>]*>", r"&[A-Za-z]+;"]
for pat in remove:
vstr = re.sub(pat, " ", vstr)
import Globals # for data
if Globals.DevelopmentMode:
if getConfiguration().debug_mode:
from traceback import format_exception
value = '\n' + ''.join(format_exception(t, vstr, tb))
else:
View
@@ -13,11 +13,19 @@
"""Initialize the Zope2 Package and provide a published module
"""
from zope.component import queryMultiAdapter
from zope.event import notify
from zope.processlifetime import DatabaseOpened
from zope.processlifetime import DatabaseOpenedWithRoot
import imp
import logging
import sys
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 noSecurityManager
from Acquisition import aq_acquire
@@ -26,21 +34,13 @@
from Acquisition import aq_parent
from Acquisition.interfaces import IAcquirer
from App.config import getConfiguration
from time import asctime
from zExceptions import Redirect
from zExceptions import Unauthorized
from ZODB.POSException import ConflictError
import transaction
import AccessControl.User
import ExtensionClass
import imp
import logging
import OFS.Application
import sys
import ZODB
import App.ZApplication
import Zope2
import ZPublisher
from zope.component import queryMultiAdapter
from zope.event import notify
from zope.processlifetime import DatabaseOpened
from zope.processlifetime import DatabaseOpenedWithRoot
app = None
startup_time = asctime()
@@ -127,7 +127,7 @@ def startup():
# Initialize the app object
application = app()
OFS.Application.initialize(application)
if Globals.DevelopmentMode:
if getConfiguration().debug_mode:
# Set up auto-refresh.
from App.RefreshFuncs import setupAutoRefresh
setupAutoRefresh(application._p_jar)
View
@@ -14,8 +14,9 @@
"""ZCML machinery
"""
import os
import os.path
from App.config import getConfiguration
from zope.configuration import xmlconfig
_initialized = False
@@ -30,11 +31,9 @@ def load_site(force=False):
return
_initialized = True
import Globals
Globals.INSTANCE_HOME
# 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):
# check for zope installation home skel during running unit tests

0 comments on commit f9cea25

Please sign in to comment.