Commit 127fb227 authored by 's avatar

- whitespace cleanup

parent 7e7c3397
...@@ -63,11 +63,11 @@ except ImportError: ...@@ -63,11 +63,11 @@ except ImportError:
class DefaultPublishTraverse(object): class DefaultPublishTraverse(object):
implements(IBrowserPublisher) implements(IBrowserPublisher)
def __init__(self, context, request): def __init__(self, context, request):
self.context = context self.context = context
self.request = request self.request = request
def publishTraverse(self, request, name): def publishTraverse(self, request, name):
object = self.context object = self.context
URL=request['URL'] URL=request['URL']
...@@ -75,7 +75,6 @@ class DefaultPublishTraverse(object): ...@@ -75,7 +75,6 @@ class DefaultPublishTraverse(object):
if name[:1]=='_': if name[:1]=='_':
raise Forbidden("Object name begins with an underscore at: %s" % URL) raise Forbidden("Object name begins with an underscore at: %s" % URL)
if hasattr(object,'__bobo_traverse__'): if hasattr(object,'__bobo_traverse__'):
try: try:
subobject=object.__bobo_traverse__(request, name) subobject=object.__bobo_traverse__(request, name)
...@@ -83,10 +82,10 @@ class DefaultPublishTraverse(object): ...@@ -83,10 +82,10 @@ class DefaultPublishTraverse(object):
# Add additional parents into the path # Add additional parents into the path
# XXX There are no tests for this: # XXX There are no tests for this:
request['PARENTS'][-1:] = list(subobject[:-1]) request['PARENTS'][-1:] = list(subobject[:-1])
object, subobject = subobject[-2:] object, subobject = subobject[-2:]
except (AttributeError, KeyError, NotFound), e: except (AttributeError, KeyError, NotFound), e:
# Try to find a view # Try to find a view
subobject = queryMultiAdapter((object, request), Interface, name) subobject = queryMultiAdapter((object, request), Interface, name)
if subobject is not None: if subobject is not None:
# OFS.Application.__bobo_traverse__ calls # OFS.Application.__bobo_traverse__ calls
# REQUEST.RESPONSE.notFoundError which sets the HTTP # REQUEST.RESPONSE.notFoundError which sets the HTTP
...@@ -112,7 +111,7 @@ class DefaultPublishTraverse(object): ...@@ -112,7 +111,7 @@ class DefaultPublishTraverse(object):
if IAcquirer.providedBy(subobject): if IAcquirer.providedBy(subobject):
subobject = subobject.__of__(object) subobject = subobject.__of__(object)
return subobject return subobject
# And lastly, of there is no view, try acquired attributes, but # And lastly, of there is no view, try acquired attributes, but
# only if there is no __bobo_traverse__: # only if there is no __bobo_traverse__:
try: try:
...@@ -129,7 +128,6 @@ class DefaultPublishTraverse(object): ...@@ -129,7 +128,6 @@ class DefaultPublishTraverse(object):
subobject = object[name] subobject = object[name]
except TypeError: # unsubscriptable except TypeError: # unsubscriptable
raise KeyError(name) raise KeyError(name)
# Ensure that the object has a docstring, or that the parent # Ensure that the object has a docstring, or that the parent
# object has a pseudo-docstring for the object. Objects that # object has a pseudo-docstring for the object. Objects that
...@@ -156,7 +154,7 @@ class DefaultPublishTraverse(object): ...@@ -156,7 +154,7 @@ class DefaultPublishTraverse(object):
) )
return subobject return subobject
def browserDefault(self, request): def browserDefault(self, request):
if hasattr(self.context, '__browser_default__'): if hasattr(self.context, '__browser_default__'):
return self.context.__browser_default__(request) return self.context.__browser_default__(request)
...@@ -169,7 +167,7 @@ class DefaultPublishTraverse(object): ...@@ -169,7 +167,7 @@ class DefaultPublishTraverse(object):
# A neater solution might be desireable. # A neater solution might be desireable.
return self.context, ('@@' + default_name,) return self.context, ('@@' + default_name,)
return self.context, () return self.context, ()
_marker=[] _marker=[]
class BaseRequest: class BaseRequest:
...@@ -285,7 +283,7 @@ class BaseRequest: ...@@ -285,7 +283,7 @@ class BaseRequest:
def __contains__(self, key): def __contains__(self, key):
return self.has_key(key) return self.has_key(key)
def keys(self): def keys(self):
keys = {} keys = {}
keys.update(self.common) keys.update(self.common)
...@@ -436,7 +434,7 @@ class BaseRequest: ...@@ -436,7 +434,7 @@ class BaseRequest:
path = request.path = request['TraversalRequestNameStack'] path = request.path = request['TraversalRequestNameStack']
# Check for method: # Check for method:
if path: if path:
entry_name = path.pop() entry_name = path.pop()
else: else:
# If we have reached the end of the path, we look to see # If we have reached the end of the path, we look to see
# if we can find IBrowserPublisher.browserDefault. If so, # if we can find IBrowserPublisher.browserDefault. If so,
...@@ -444,22 +442,22 @@ class BaseRequest: ...@@ -444,22 +442,22 @@ class BaseRequest:
# BrowserDefault returns the object to be published # BrowserDefault returns the object to be published
# (usually self) and a sequence of names to traverse to # (usually self) and a sequence of names to traverse to
# find the method to be published. # find the method to be published.
# This is webdav support. The last object in the path # This is webdav support. The last object in the path
# should not be acquired. Instead, a NullResource should # should not be acquired. Instead, a NullResource should
# be given if it doesn't exist: # be given if it doesn't exist:
if (no_acquire_flag and if (no_acquire_flag and
hasattr(object, 'aq_base') and hasattr(object, 'aq_base') and
not hasattr(object,'__bobo_traverse__')): not hasattr(object,'__bobo_traverse__')):
if object.aq_parent is not object.aq_inner.aq_parent: if object.aq_parent is not object.aq_inner.aq_parent:
from webdav.NullResource import NullResource from webdav.NullResource import NullResource
object = NullResource(parents[-2], object.getId(), object = NullResource(parents[-2], object.getId(),
self).__of__(parents[-2]) self).__of__(parents[-2])
if IBrowserPublisher.providedBy(object): if IBrowserPublisher.providedBy(object):
adapter = object adapter = object
else: else:
adapter = queryMultiAdapter((object, self), adapter = queryMultiAdapter((object, self),
IBrowserPublisher) IBrowserPublisher)
if adapter is None: if adapter is None:
# Zope2 doesn't set up its own adapters in a lot # Zope2 doesn't set up its own adapters in a lot
...@@ -493,15 +491,15 @@ class BaseRequest: ...@@ -493,15 +491,15 @@ class BaseRequest:
step = quote(entry_name) step = quote(entry_name)
_steps.append(step) _steps.append(step)
request['URL'] = URL = '%s/%s' % (request['URL'], step) request['URL'] = URL = '%s/%s' % (request['URL'], step)
try: try:
subobject = self.traverseName(object, entry_name) subobject = self.traverseName(object, entry_name)
if (hasattr(object,'__bobo_traverse__') or if (hasattr(object,'__bobo_traverse__') or
hasattr(object, entry_name)): hasattr(object, entry_name)):
check_name = entry_name check_name = entry_name
else: else:
check_name = None check_name = None
self.roles = getRoles( self.roles = getRoles(
object, check_name, subobject, object, check_name, subobject,
self.roles) self.roles)
...@@ -516,7 +514,7 @@ class BaseRequest: ...@@ -516,7 +514,7 @@ class BaseRequest:
except Forbidden, e: except Forbidden, e:
if self.response.debug_mode: if self.response.debug_mode:
return response.debugError(e.args) return response.debugError(e.args)
else: else:
return response.forbiddenError(entry_name) return response.forbiddenError(entry_name)
parents.append(object) parents.append(object)
...@@ -524,7 +522,7 @@ class BaseRequest: ...@@ -524,7 +522,7 @@ class BaseRequest:
steps.append(entry_name) steps.append(entry_name)
finally: finally:
parents.reverse() parents.reverse()
# Note - no_acquire_flag is necessary to support # Note - no_acquire_flag is necessary to support
# things like DAV. We have to make sure # things like DAV. We have to make sure
# that the target object is not acquired # that the target object is not acquired
...@@ -535,12 +533,12 @@ class BaseRequest: ...@@ -535,12 +533,12 @@ class BaseRequest:
# heirarchy -- you'd always get the # heirarchy -- you'd always get the
# existing object :( # existing object :(
if (no_acquire_flag and if (no_acquire_flag and
hasattr(parents[1], 'aq_base') and hasattr(parents[1], 'aq_base') and
not hasattr(parents[1],'__bobo_traverse__')): not hasattr(parents[1],'__bobo_traverse__')):
if not (hasattr(parents[1].aq_base, entry_name) or if not (hasattr(parents[1].aq_base, entry_name) or
parents[1].aq_base.has_key(entry_name)): parents[1].aq_base.has_key(entry_name)):
raise AttributeError, entry_name raise AttributeError, entry_name
# After traversal post traversal hooks aren't available anymore # After traversal post traversal hooks aren't available anymore
del self._post_traverse del self._post_traverse
...@@ -626,7 +624,7 @@ class BaseRequest: ...@@ -626,7 +624,7 @@ class BaseRequest:
def post_traverse(self, f, args=()): def post_traverse(self, f, args=()):
"""Add a callable object and argument tuple to be post-traversed. """Add a callable object and argument tuple to be post-traversed.
If traversal and authentication succeed, each post-traversal If traversal and authentication succeed, each post-traversal
pair is processed in the order in which they were added. pair is processed in the order in which they were added.
Each argument tuple is passed to its callable. If a callable Each argument tuple is passed to its callable. If a callable
...@@ -705,7 +703,6 @@ def old_validation(groups, request, auth, ...@@ -705,7 +703,6 @@ def old_validation(groups, request, auth,
return None return None
# This mapping contains the built-in types that gained docstrings # This mapping contains the built-in types that gained docstrings
# between Python 2.1 and 2.2.2. By specifically checking for these # between Python 2.1 and 2.2.2. By specifically checking for these
# types during publishing, we ensure the same publishing rules in # types during publishing, we ensure the same publishing rules in
......
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