[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - Publish.py:1.167
Fred L. Drake, Jr.
fred at zope.com
Sun Apr 25 17:26:47 EDT 2004
Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv13370/ZPublisher
Modified Files:
Publish.py
Log Message:
Remove all uses of environment variables for configuring ZPublisher.
=== Zope/lib/python/ZPublisher/Publish.py 1.166 => 1.167 ===
--- Zope/lib/python/ZPublisher/Publish.py:1.166 Tue Nov 18 08:17:17 2003
+++ Zope/lib/python/ZPublisher/Publish.py Sun Apr 25 17:26:15 2004
@@ -47,6 +47,17 @@
def dont_publish_class(klass, request):
request.response.forbiddenError("class %s" % klass.__name__)
+_default_debug_mode = False
+_default_realm = None
+
+def set_default_debug_mode(debug_mode):
+ global _default_debug_mode
+ _default_debug_mode = debug_mode
+
+def set_default_authentication_realm(realm):
+ global _default_realm
+ _default_realm = realm
+
def publish(request, module_name, after_list, debug=0,
# Optimize:
call_object=call_object,
@@ -224,10 +235,8 @@
# Let the app specify a realm
if hasattr(module,'__bobo_realm__'):
realm=module.__bobo_realm__
- elif os.environ.has_key('Z_REALM'):
- realm=os.environ['Z_REALM']
- elif os.environ.has_key('BOBO_REALM'):
- realm=os.environ['BOBO_REALM']
+ elif _default_realm is not None:
+ realm=_default_realm
else:
realm=module_name
@@ -236,15 +245,7 @@
if hasattr(module,'__bobo_debug_mode__'):
debug_mode=not not module.__bobo_debug_mode__
else:
-
- z1 = os.environ.get('Z_DEBUG_MODE','')
- z2 = os.environ.get('BOBO_DEBUG_MODE','')
-
- if z1.lower() in ('yes','y') or z1.isdigit():
- debug_mode = 1
- elif z2.lower() in ('yes','y') or z2.isdigit():
- debug_mode = 1
-
+ debug_mode = _default_debug_mode
bobo_before = getattr(module, "__bobo_before__", None)
bobo_after = getattr(module, "__bobo_after__", None)
More information about the Zope-Checkins
mailing list