Commit 0cdd3ddf authored by Hanno Schlichting's avatar Hanno Schlichting Committed by GitHub

Merge pull request #55 from zopefoundation/apply-hotfix-20160419-master

Apply hotfix 20160419 [master]
parents cdce8d52 aa3ae549
...@@ -11,6 +11,9 @@ http://docs.zope.org/zope2/ ...@@ -11,6 +11,9 @@ http://docs.zope.org/zope2/
Bugs Fixed Bugs Fixed
++++++++++ ++++++++++
- Removed docstrings from some methods to avoid publishing them. From
Products.PloneHotfix20160419. [maurits]
- bobo_traverse of ProductDispatcher did not correctly invalidate cache - bobo_traverse of ProductDispatcher did not correctly invalidate cache
when a product was not initializes after first access of the cache. Types when a product was not initializes after first access of the cache. Types
that were added in test-profiles were not useable. that were added in test-profiles were not useable.
......
...@@ -174,13 +174,13 @@ class Application(ApplicationDefaultPermissions, ...@@ -174,13 +174,13 @@ class Application(ApplicationDefaultPermissions,
return self return self
def getPhysicalPath(self): def getPhysicalPath(self):
"""Get the physical path of the object. # Get the physical path of the object.
#
Returns a path (an immutable sequence of strings) that can be used to # Returns a path (an immutable sequence of strings) that can be used to
access this object again later, for example in a copy/paste operation. # access this object again later, for example in a copy/paste
getPhysicalRoot() and getPhysicalPath() are designed to operate # operation. getPhysicalRoot() and getPhysicalPath() are designed to
together. # operate together.
""" #
# We're at the base of the path. # We're at the base of the path.
return ('', ) return ('', )
......
...@@ -144,9 +144,7 @@ class Cacheable: ...@@ -144,9 +144,7 @@ class Cacheable:
security.declarePrivate('ZCacheable_getObAndView') security.declarePrivate('ZCacheable_getObAndView')
def ZCacheable_getObAndView(self, view_name): def ZCacheable_getObAndView(self, view_name):
""" # Returns self and view_name unchanged.
Returns self and view_name unchanged.
"""
return self, view_name return self, view_name
security.declarePrivate('ZCacheable_get') security.declarePrivate('ZCacheable_get')
......
...@@ -199,14 +199,12 @@ class DTMLMethod(RestrictedDTML, ...@@ -199,14 +199,12 @@ class DTMLMethod(RestrictedDTML,
security.declareProtected(change_dtml_methods, 'getCacheNamespaceKeys') security.declareProtected(change_dtml_methods, 'getCacheNamespaceKeys')
def getCacheNamespaceKeys(self): def getCacheNamespaceKeys(self):
""" Return the cacheNamespaceKeys. # Return the cacheNamespaceKeys.
"""
return self._cache_namespace_keys return self._cache_namespace_keys
security.declareProtected(change_dtml_methods, 'setCacheNamespaceKeys') security.declareProtected(change_dtml_methods, 'setCacheNamespaceKeys')
def setCacheNamespaceKeys(self, keys, REQUEST=None): def setCacheNamespaceKeys(self, keys, REQUEST=None):
""" Set the list of names looked up to provide a cache key. # Set the list of names looked up to provide a cache key.
"""
ks = [] ks = []
for key in keys: for key in keys:
key = str(key).strip() key = str(key).strip()
...@@ -354,14 +352,12 @@ class DTMLMethod(RestrictedDTML, ...@@ -354,14 +352,12 @@ class DTMLMethod(RestrictedDTML,
security.declareProtected(view_management_screens, 'PrincipiaSearchSource') security.declareProtected(view_management_screens, 'PrincipiaSearchSource')
def PrincipiaSearchSource(self): def PrincipiaSearchSource(self):
""" Support for searching - the document's contents are searched. # Support for searching - the document's contents are searched.
"""
return self.read() return self.read()
security.declareProtected(view_management_screens, 'document_src') security.declareProtected(view_management_screens, 'document_src')
def document_src(self, REQUEST=None, RESPONSE=None): def document_src(self, REQUEST=None, RESPONSE=None):
""" Return unprocessed document source. # Return unprocessed document source.
"""
if RESPONSE is not None: if RESPONSE is not None:
RESPONSE.setHeader('Content-Type', 'text/plain') RESPONSE.setHeader('Content-Type', 'text/plain')
return self.read() return self.read()
......
...@@ -433,8 +433,7 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -433,8 +433,7 @@ class File(Persistent, Implicit, PropertyManager,
security.declareProtected(View, 'PrincipiaSearchSource') security.declareProtected(View, 'PrincipiaSearchSource')
def PrincipiaSearchSource(self): def PrincipiaSearchSource(self):
""" Allow file objects to be searched. # Allow file objects to be searched.
"""
if self.content_type.startswith('text/'): if self.content_type.startswith('text/'):
return str(self.data) return str(self.data)
return '' return ''
...@@ -597,10 +596,8 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -597,10 +596,8 @@ class File(Persistent, Implicit, PropertyManager,
security.declareProtected(View, 'get_size') security.declareProtected(View, 'get_size')
def get_size(self): def get_size(self):
"""Get the size of a file or image. # Get the size of a file or image.
# Returns the size of the file or image.
Returns the size of the file or image.
"""
size=self.size size=self.size
if size is None: size=len(self.data) if size is None: size=len(self.data)
return size return size
...@@ -610,10 +607,8 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -610,10 +607,8 @@ class File(Persistent, Implicit, PropertyManager,
security.declareProtected(View, 'getContentType') security.declareProtected(View, 'getContentType')
def getContentType(self): def getContentType(self):
"""Get the content type of a file or image. # Get the content type of a file or image.
# Returns the content type (MIME type) of a file or image.
Returns the content type (MIME type) of a file or image.
"""
return self.content_type return self.content_type
......
...@@ -295,12 +295,11 @@ class ObjectManager(CopyContainer, ...@@ -295,12 +295,11 @@ class ObjectManager(CopyContainer,
security.declareProtected(access_contents_information, 'hasObject') security.declareProtected(access_contents_information, 'hasObject')
def hasObject(self, id): def hasObject(self, id):
"""Indicate whether the folder has an item by ID. # Indicate whether the folder has an item by ID.
#
This doesn't try to be more intelligent than _getOb, and doesn't # This doesn't try to be more intelligent than _getOb, and doesn't
consult _objects (for performance reasons). The common use case # consult _objects (for performance reasons). The common use case
is to check that an object does *not* exist. # is to check that an object does *not* exist.
"""
if (id in ('.', '..') or if (id in ('.', '..') or
id.startswith('_') or id.startswith('_') or
id.startswith('aq_') or id.startswith('aq_') or
......
...@@ -132,8 +132,7 @@ class OrderSupport(object): ...@@ -132,8 +132,7 @@ class OrderSupport(object):
security.declareProtected(manage_properties, 'moveObjectsByDelta') security.declareProtected(manage_properties, 'moveObjectsByDelta')
def moveObjectsByDelta(self, ids, delta, subset_ids=None, def moveObjectsByDelta(self, ids, delta, subset_ids=None,
suppress_events=False): suppress_events=False):
""" Move specified sub-objects by delta. # Move specified sub-objects by delta.
"""
if isinstance(ids, basestring): if isinstance(ids, basestring):
ids = (ids,) ids = (ids,)
min_position = 0 min_position = 0
...@@ -183,32 +182,27 @@ class OrderSupport(object): ...@@ -183,32 +182,27 @@ class OrderSupport(object):
security.declareProtected(manage_properties, 'moveObjectsUp') security.declareProtected(manage_properties, 'moveObjectsUp')
def moveObjectsUp(self, ids, delta=1, subset_ids=None): def moveObjectsUp(self, ids, delta=1, subset_ids=None):
""" Move specified sub-objects up by delta in container. # Move specified sub-objects up by delta in container.
"""
return self.moveObjectsByDelta(ids, -delta, subset_ids) return self.moveObjectsByDelta(ids, -delta, subset_ids)
security.declareProtected(manage_properties, 'moveObjectsDown') security.declareProtected(manage_properties, 'moveObjectsDown')
def moveObjectsDown(self, ids, delta=1, subset_ids=None): def moveObjectsDown(self, ids, delta=1, subset_ids=None):
""" Move specified sub-objects down by delta in container. # Move specified sub-objects down by delta in container.
"""
return self.moveObjectsByDelta(ids, delta, subset_ids) return self.moveObjectsByDelta(ids, delta, subset_ids)
security.declareProtected(manage_properties, 'moveObjectsToTop') security.declareProtected(manage_properties, 'moveObjectsToTop')
def moveObjectsToTop(self, ids, subset_ids=None): def moveObjectsToTop(self, ids, subset_ids=None):
""" Move specified sub-objects to top of container. # Move specified sub-objects to top of container.
"""
return self.moveObjectsByDelta( ids, -len(self._objects), subset_ids ) return self.moveObjectsByDelta( ids, -len(self._objects), subset_ids )
security.declareProtected(manage_properties, 'moveObjectsToBottom') security.declareProtected(manage_properties, 'moveObjectsToBottom')
def moveObjectsToBottom(self, ids, subset_ids=None): def moveObjectsToBottom(self, ids, subset_ids=None):
""" Move specified sub-objects to bottom of container. # Move specified sub-objects to bottom of container.
"""
return self.moveObjectsByDelta( ids, len(self._objects), subset_ids ) return self.moveObjectsByDelta( ids, len(self._objects), subset_ids )
security.declareProtected(manage_properties, 'orderObjects') security.declareProtected(manage_properties, 'orderObjects')
def orderObjects(self, key, reverse=None): def orderObjects(self, key, reverse=None):
""" Order sub-objects by key and direction. # Order sub-objects by key and direction.
"""
ids = [ id for id, obj in sort( self.objectItems(), ids = [ id for id, obj in sort( self.objectItems(),
( (key, 'cmp', 'asc'), ) ) ] ( (key, 'cmp', 'asc'), ) ) ]
if reverse: if reverse:
...@@ -218,8 +212,7 @@ class OrderSupport(object): ...@@ -218,8 +212,7 @@ class OrderSupport(object):
security.declareProtected(access_contents_information, security.declareProtected(access_contents_information,
'getObjectPosition') 'getObjectPosition')
def getObjectPosition(self, id): def getObjectPosition(self, id):
""" Get the position of an object by its id. # Get the position of an object by its id.
"""
ids = self.objectIds() ids = self.objectIds()
if id in ids: if id in ids:
return ids.index(id) return ids.index(id)
...@@ -227,22 +220,19 @@ class OrderSupport(object): ...@@ -227,22 +220,19 @@ class OrderSupport(object):
security.declareProtected(manage_properties, 'moveObjectToPosition') security.declareProtected(manage_properties, 'moveObjectToPosition')
def moveObjectToPosition(self, id, position, suppress_events=False): def moveObjectToPosition(self, id, position, suppress_events=False):
""" Move specified object to absolute position. # Move specified object to absolute position.
"""
delta = position - self.getObjectPosition(id) delta = position - self.getObjectPosition(id)
return self.moveObjectsByDelta(id, delta, return self.moveObjectsByDelta(id, delta,
suppress_events=suppress_events) suppress_events=suppress_events)
security.declareProtected(access_contents_information, 'getDefaultSorting') security.declareProtected(access_contents_information, 'getDefaultSorting')
def getDefaultSorting(self): def getDefaultSorting(self):
""" Get default sorting key and direction. # Get default sorting key and direction.
"""
return self._default_sort_key, self._default_sort_reverse return self._default_sort_key, self._default_sort_reverse
security.declareProtected(manage_properties, 'setDefaultSorting') security.declareProtected(manage_properties, 'setDefaultSorting')
def setDefaultSorting(self, key, reverse): def setDefaultSorting(self, key, reverse):
""" Set default sorting key and direction. # Set default sorting key and direction.
"""
self._default_sort_key = key self._default_sort_key = key
self._default_sort_reverse = reverse and 1 or 0 self._default_sort_reverse = reverse and 1 or 0
......
...@@ -112,8 +112,8 @@ class PropertySheet(Traversable, Persistent, Implicit): ...@@ -112,8 +112,8 @@ class PropertySheet(Traversable, Persistent, Implicit):
__reserved_ids= ('values','items') __reserved_ids= ('values','items')
def property_extensible_schema__(self): def property_extensible_schema__(self):
"""Return a flag indicating whether new properties may be # Return a flag indicating whether new properties may be
added or removed.""" # added or removed.
return self._extensible return self._extensible
def __init__(self, id, md=None): def __init__(self, id, md=None):
...@@ -169,8 +169,8 @@ class PropertySheet(Traversable, Persistent, Implicit): ...@@ -169,8 +169,8 @@ class PropertySheet(Traversable, Persistent, Implicit):
security.declareProtected(access_contents_information, 'getPropertyType') security.declareProtected(access_contents_information, 'getPropertyType')
def getPropertyType(self, id): def getPropertyType(self, id):
"""Get the type of property 'id', returning None if no # Get the type of property 'id', returning None if no
such property exists""" # such property exists.
pself=self.p_self() pself=self.p_self()
for md in pself._properties: for md in pself._properties:
if md['id']==id: if md['id']==id:
......
...@@ -406,13 +406,13 @@ class Item_w__name__(Item): ...@@ -406,13 +406,13 @@ class Item_w__name__(Item):
self.__name__=id self.__name__=id
def getPhysicalPath(self): def getPhysicalPath(self):
"""Get the physical path of the object. # Get the physical path of the object.
#
# Returns a path (an immutable sequence of strings) that can be used to
# access this object again later, for example in a copy/paste
# operation. getPhysicalRoot() and getPhysicalPath() are designed to
# operate together.
Returns a path (an immutable sequence of strings) that can be used to
access this object again later, for example in a copy/paste operation.
getPhysicalRoot() and getPhysicalPath() are designed to operate
together.
"""
path = (self.__name__, ) path = (self.__name__, )
p = aq_parent(aq_inner(self)) p = aq_parent(aq_inner(self))
if p is not None: if p is not None:
......
...@@ -108,16 +108,15 @@ class Traversable: ...@@ -108,16 +108,15 @@ class Traversable:
security.declarePublic('getPhysicalPath') security.declarePublic('getPhysicalPath')
def getPhysicalPath(self): def getPhysicalPath(self):
"""Get the physical path of the object. # Get the physical path of the object.
#
Returns a path (an immutable sequence of strings) that can be used to # Returns a path (an immutable sequence of strings) that can be used to
access this object again later, for example in a copy/paste operation. # access this object again later, for example in a copy/paste
getPhysicalRoot() and getPhysicalPath() are designed to operate # operation. getPhysicalRoot() and getPhysicalPath() are designed to
together. # operate together.
This implementation is optimized to avoid excessive amounts of function # This implementation is optimized to avoid excessive amounts of
calls while walking up from an object on a deep level. # function calls while walking up from an object on a deep level.
"""
try: try:
id = self.id or self.getId() id = self.id or self.getId()
except AttributeError: except AttributeError:
......
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