SVN: Zope/trunk/src/ - use getConfiguration() instead of Globals

Yvo Schubbe <[email protected]>
Newsgroups gmane.comp.web.zope.cvs
Message-ID <[email protected]>
Log message for revision 120778:
  - use getConfiguration() instead of Globals

Changed:
  UU  Zope/trunk/src/App/ImageFile.py
  UU  Zope/trunk/src/App/special_dtml.py
  U   Zope/trunk/src/HelpSys/HelpTopic.py
  UU  Zope/trunk/src/Products/PageTemplates/PageTemplateFile.py
  UU  Zope/trunk/src/ZPublisher/xmlrpc.py
  UU  Zope/trunk/src/Zope2/App/startup.py
  UU  Zope/trunk/src/Zope2/App/zcml.py

-=-
Modified: Zope/trunk/src/App/ImageFile.py
===================================================================
--- Zope/trunk/src/App/ImageFile.py	2011-03-07 10:31:11 UTC (rev 120777)
+++ Zope/trunk/src/App/ImageFile.py	2011-03-07 10:34:58 UTC (rev 120778)
@@ -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 @@
     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 @@
         # _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:


Property changes on: Zope/trunk/src/App/ImageFile.py
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
   - 1.20

Modified: Zope/trunk/src/App/special_dtml.py
===================================================================
--- Zope/trunk/src/App/special_dtml.py	2011-03-07 10:31:11 UTC (rev 120777)
+++ Zope/trunk/src/App/special_dtml.py	2011-03-07 10:34:58 UTC (rev 120778)
@@ -7,16 +7,21 @@
 # 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
+import os
+import sys
+from logging import getLogger
 from types import InstanceType
-from logging import getLogger
+
+import DocumentTemplate
+import MethodObject
+import Persistence
+from App import Common
 from App.config import getConfiguration
 
-
 LOG = getLogger('special_dtml')
 
 import Zope2
@@ -49,7 +54,7 @@
         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


Property changes on: Zope/trunk/src/App/special_dtml.py
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
   - 1.26

Modified: Zope/trunk/src/HelpSys/HelpTopic.py
===================================================================
--- Zope/trunk/src/HelpSys/HelpTopic.py	2011-03-07 10:31:11 UTC (rev 120777)
+++ Zope/trunk/src/HelpSys/HelpTopic.py	2011-03-07 10:34:58 UTC (rev 120778)
@@ -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 @@
         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:

Modified: Zope/trunk/src/Products/PageTemplates/PageTemplateFile.py
===================================================================
--- Zope/trunk/src/Products/PageTemplates/PageTemplateFile.py	2011-03-07 10:31:11 UTC (rev 120777)
+++ Zope/trunk/src/Products/PageTemplates/PageTemplateFile.py	2011-03-07 10:34:58 UTC (rev 120778)
@@ -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 @@
         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:


Property changes on: Zope/trunk/src/Products/PageTemplates/PageTemplateFile.py
___________________________________________________________________
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/ZPublisher/xmlrpc.py
===================================================================
--- Zope/trunk/src/ZPublisher/xmlrpc.py	2011-03-07 10:31:11 UTC (rev 120777)
+++ Zope/trunk/src/ZPublisher/xmlrpc.py	2011-03-07 10:34:58 UTC (rev 120778)
@@ -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 @@
             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:


Property changes on: Zope/trunk/src/ZPublisher/xmlrpc.py
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
   - 1.19

Modified: Zope/trunk/src/Zope2/App/startup.py
===================================================================
--- Zope/trunk/src/Zope2/App/startup.py	2011-03-07 10:31:11 UTC (rev 120777)
+++ Zope/trunk/src/Zope2/App/startup.py	2011-03-07 10:34:58 UTC (rev 120778)
@@ -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 @@
     # 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)


Property changes on: Zope/trunk/src/Zope2/App/startup.py
___________________________________________________________________
Deleted: svn:keywords
   - Id

Modified: Zope/trunk/src/Zope2/App/zcml.py
===================================================================
--- Zope/trunk/src/Zope2/App/zcml.py	2011-03-07 10:31:11 UTC (rev 120777)
+++ Zope/trunk/src/Zope2/App/zcml.py	2011-03-07 10:34:58 UTC (rev 120778)
@@ -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 @@
         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


Property changes on: Zope/trunk/src/Zope2/App/zcml.py
___________________________________________________________________
Deleted: svn:keywords
   - Id

_______________________________________________
Zope-Checkins maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-checkins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.