Commit 6199c1e4 authored by Hanno Schlichting's avatar Hanno Schlichting

Setup default validated_hook.

parent ddea96bb
...@@ -18,6 +18,7 @@ import sys ...@@ -18,6 +18,7 @@ import sys
from thread import allocate_lock from thread import allocate_lock
import time import time
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager from AccessControl.SecurityManagement import noSecurityManager
import transaction import transaction
from zExceptions import ( from zExceptions import (
...@@ -78,6 +79,10 @@ def missing_name(name, request): ...@@ -78,6 +79,10 @@ def missing_name(name, request):
request.response.badRequestError(name) request.response.badRequestError(name)
def validate_user(request, user):
newSecurityManager(request, user)
def set_default_debug_mode(debug_mode): def set_default_debug_mode(debug_mode):
global _DEFAULT_DEBUG_MODE global _DEFAULT_DEBUG_MODE
_DEFAULT_DEBUG_MODE = debug_mode _DEFAULT_DEBUG_MODE = debug_mode
...@@ -107,7 +112,8 @@ def get_module_info(module_name='Zope2'): ...@@ -107,7 +112,8 @@ def get_module_info(module_name='Zope2'):
bobo_before = getattr(module, '__bobo_before__', None) bobo_before = getattr(module, '__bobo_before__', None)
bobo_after = getattr(module, '__bobo_after__', None) bobo_after = getattr(module, '__bobo_after__', None)
error_hook = getattr(module, 'zpublisher_exception_hook', None) error_hook = getattr(module, 'zpublisher_exception_hook', None)
validated_hook = getattr(module, 'zpublisher_validated_hook', None) validated_hook = getattr(
module, 'zpublisher_validated_hook', validate_user)
transactions_manager = getattr( transactions_manager = getattr(
module, 'zpublisher_transactions_manager', transaction.manager) module, 'zpublisher_transactions_manager', transaction.manager)
...@@ -115,7 +121,7 @@ def get_module_info(module_name='Zope2'): ...@@ -115,7 +121,7 @@ def get_module_info(module_name='Zope2'):
error_hook, validated_hook, transactions_manager) error_hook, validated_hook, transactions_manager)
_MODULES[module_name] = info _MODULES[module_name] = info
return info return info
class WSGIResponse(HTTPResponse): class WSGIResponse(HTTPResponse):
......
...@@ -41,6 +41,11 @@ deprecated( ...@@ -41,6 +41,11 @@ deprecated(
ZPublisherExceptionHook='ZServer.ZPublisher.exceptionhook:ExceptionHook', ZPublisherExceptionHook='ZServer.ZPublisher.exceptionhook:ExceptionHook',
) )
deprecated(
'Please import from ZPublisher.WSGIPublisher.',
validated_hook='ZPublisher.WSGIPublisher:validate_user',
)
app = None app = None
startup_time = asctime() startup_time = asctime()
_patched = False _patched = False
...@@ -149,8 +154,3 @@ def startup(): ...@@ -149,8 +154,3 @@ def startup():
notify(DatabaseOpenedWithRoot(DB)) notify(DatabaseOpenedWithRoot(DB))
Zope2.zpublisher_transactions_manager = transaction.manager Zope2.zpublisher_transactions_manager = transaction.manager
Zope2.zpublisher_validated_hook = validated_hook
def validated_hook(request, user):
newSecurityManager(request, user)
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