[Zope-Checkins] CVS: Zope/lib/python/OFS - Application.py:1.187 Cache.py:1.10 CopySupport.py:1.82 DTMLDocument.py:1.48 DTMLMethod.py:1.79 DefaultObservable.py:1.6 Document.py:1.76 FTPInterface.py:1.4 FindSupport.py:1.31 Folder.py:1.101 History.py:1.14 Image.py:1.140 Moniker.py:1.16 ObjectManager.py:1.158 PropertyManager.py:1.46 PropertySheets.py:1.87 SimpleItem.py:1.102 Traversable.py:1.15 Uninstalled.py:1.15 XMLExportImport.py:1.4 ZDOM.py:1.12 __init__.py:1.10 content_types.py:1.18 misc_.py:1.21 ndiff.py:1.4 rPickle.py:1.6
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 17:42:57 -0400
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv15193
Modified Files:
Application.py Cache.py CopySupport.py DTMLDocument.py
DTMLMethod.py DefaultObservable.py Document.py FTPInterface.py
FindSupport.py Folder.py History.py Image.py Moniker.py
ObjectManager.py PropertyManager.py PropertySheets.py
SimpleItem.py Traversable.py Uninstalled.py XMLExportImport.py
ZDOM.py __init__.py content_types.py misc_.py ndiff.py
rPickle.py
Log Message:
Clean up indentation and trailing whitespace.
As the 'if 1:' block for diff preservation was heavily tabbed anyway, I
removed an indent level and the 'if 1:' statement.
=== Zope/lib/python/OFS/Application.py 1.186 => 1.187 ===
--- Zope/lib/python/OFS/Application.py:1.186 Fri Aug 9 10:51:53 2002
+++ Zope/lib/python/OFS/Application.py Wed Aug 14 17:42:55 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
__doc__='''Application support
@@ -57,7 +57,7 @@
# emergency user can still access the system if the top-level
# UserFolder is deleted. This is necessary to allow people
# to replace the top-level UserFolder object.
-
+
__allow_groups__=UserFolder()
# Set the universal default method to index_html
@@ -129,7 +129,7 @@
"""Move a resource to a new location."""
self.dav__init(REQUEST, RESPONSE)
raise 'Forbidden', 'This resource cannot be moved.'
-
+
test_url___allow_groups__=None
test_url=ZopeAttributionButton
@@ -276,7 +276,7 @@
get_transaction().note('Added temp_folder')
get_transaction().commit()
del tf
-
+
# Ensure that there is a transient container in the temp folder
tf = app.temp_folder
if not hasattr(aq_base(tf), 'session_data'):
@@ -344,7 +344,7 @@
del delnotify
del timeout_spec
del env_has
-
+
del tf
# Ensure that a browser ID manager exists
@@ -437,7 +437,7 @@
# Check for dangling pointers (broken zclass dependencies) in the
# global class registry. If found, rebuild the registry. Note that
- # if the check finds problems but fails to successfully rebuild the
+ # if the check finds problems but fails to successfully rebuild the
# registry we abort the transaction so that we don't leave it in an
# indeterminate state.
@@ -528,37 +528,36 @@
modules=sys.modules
have_module=modules.has_key
- if 1: # Preserve indentation for diff :-)
- try:
- package_dir=path_join(product_dir, product_name)
- if not isdir(package_dir): return
- if not exists(path_join(package_dir, '__init__.py')):
- if not exists(path_join(package_dir, '__init__.pyc')):
- if not exists(path_join(package_dir, '__init__.pyo')):
- return
+ try:
+ package_dir=path_join(product_dir, product_name)
+ if not isdir(package_dir): return
+ if not exists(path_join(package_dir, '__init__.py')):
+ if not exists(path_join(package_dir, '__init__.pyc')):
+ if not exists(path_join(package_dir, '__init__.pyo')):
+ return
- pname="Products.%s" % product_name
- try:
- product=__import__(pname, global_dict, global_dict, silly)
- if hasattr(product, '__module_aliases__'):
- for k, v in product.__module_aliases__:
- if not have_module(k):
- if type(v) is _st and have_module(v): v=modules[v]
- modules[k]=v
- except:
- exc = sys.exc_info()
- if log_exc:
- LOG('Zope', ERROR, 'Could not import %s' % pname,
- error=exc)
- f=StringIO()
- traceback.print_exc(100,f)
- f=f.getvalue()
- try: modules[pname].__import_error__=f
- except: pass
- if raise_exc:
- raise exc[0], exc[1], exc[2]
- finally:
- exc = None
+ pname="Products.%s" % product_name
+ try:
+ product=__import__(pname, global_dict, global_dict, silly)
+ if hasattr(product, '__module_aliases__'):
+ for k, v in product.__module_aliases__:
+ if not have_module(k):
+ if type(v) is _st and have_module(v): v=modules[v]
+ modules[k]=v
+ except:
+ exc = sys.exc_info()
+ if log_exc:
+ LOG('Zope', ERROR, 'Could not import %s' % pname,
+ error=exc)
+ f=StringIO()
+ traceback.print_exc(100,f)
+ f=f.getvalue()
+ try: modules[pname].__import_error__=f
+ except: pass
+ if raise_exc:
+ raise exc[0], exc[1], exc[2]
+ finally:
+ exc = None
def install_products(app):
@@ -608,115 +607,115 @@
silly=('__doc__',)
if 1: # Preserve indentation for diff :-)
- package_dir=path_join(product_dir, product_name)
- __traceback_info__=product_name
- if not isdir(package_dir): return
- if not exists(path_join(package_dir, '__init__.py')):
- if not exists(path_join(package_dir, '__init__.pyc')):
- if not exists(path_join(package_dir, '__init__.pyo')):
- return
- try:
- product=__import__("Products.%s" % product_name,
- global_dict, global_dict, silly)
-
- # Install items into the misc_ namespace, used by products
- # and the framework itself to store common static resources
- # like icon images.
- misc_=pgetattr(product, 'misc_', {})
- if misc_:
- if type(misc_) is DictType:
- misc_=Misc_(product_name, misc_)
- Application.misc_.__dict__[product_name]=misc_
-
- # Here we create a ProductContext object which contains
- # information about the product and provides an interface
- # for registering things like classes and help topics that
- # should be associated with that product. Products are
- # expected to implement a method named 'initialize' in
- # their __init__.py that takes the ProductContext as an
- # argument.
- productObject=App.Product.initializeProduct(
- product, product_name, package_dir, app)
- context=ProductContext(productObject, app, product)
-
- # Look for an 'initialize' method in the product. If it does
- # not exist, then this is an old product that has never been
- # updated. In that case, we will analyze the product and
- # build up enough information to do initialization manually.
- initmethod=pgetattr(product, 'initialize', None)
- if initmethod is not None:
- initmethod(context)
-
- # Support old-style product metadata. Older products may
- # define attributes to name their permissions, meta_types,
- # constructors, etc.
- permissions={}
- new_permissions={}
- for p in pgetattr(product, '__ac_permissions__', ()):
- permission, names, default = (
- tuple(p)+('Manager',))[:3]
- if names:
- for name in names:
- permissions[name]=permission
- elif not folder_permissions.has_key(permission):
- new_permissions[permission]=()
-
- for meta_type in pgetattr(product, 'meta_types', ()):
- # Modern product initialization via a ProductContext
- # adds 'product' and 'permission' keys to the meta_type
- # mapping. We have to add these here for old products.
- pname=permissions.get(meta_type['action'], None)
- if pname is not None:
- meta_type['permission']=pname
- meta_type['product']=productObject.id
- meta_type['visibility'] = 'Global'
- meta_types.append(meta_type)
-
- for name,method in pgetattr(
- product, 'methods', {}).items():
- if not hasattr(Folder.Folder, name):
- setattr(Folder.Folder, name, method)
- if name[-9:]!='__roles__': # not Just setting roles
- if (permissions.has_key(name) and
- not folder_permissions.has_key(
- permissions[name])):
- permission=permissions[name]
- if new_permissions.has_key(permission):
- new_permissions[permission].append(name)
- else:
- new_permissions[permission]=[name]
-
- if new_permissions:
- new_permissions=new_permissions.items()
- for permission, names in new_permissions:
- folder_permissions[permission]=names
- new_permissions.sort()
- Folder.Folder.__dict__['__ac_permissions__']=tuple(
- list(Folder.Folder.__ac_permissions__)+new_permissions)
-
- if (os.environ.get('ZEO_CLIENT') and
- not os.environ.get('FORCE_PRODUCT_LOAD')):
- # we don't want to install products from clients
- # (unless FORCE_PRODUCT_LOAD is defined).
- get_transaction().abort()
- else:
- get_transaction().note('Installed product '+product_name)
- get_transaction().commit()
+ package_dir=path_join(product_dir, product_name)
+ __traceback_info__=product_name
+ if not isdir(package_dir): return
+ if not exists(path_join(package_dir, '__init__.py')):
+ if not exists(path_join(package_dir, '__init__.pyc')):
+ if not exists(path_join(package_dir, '__init__.pyo')):
+ return
+ try:
+ product=__import__("Products.%s" % product_name,
+ global_dict, global_dict, silly)
- except:
- if log_exc:
- LOG('Zope',ERROR,'Couldn\'t install %s' % product_name,
- error=sys.exc_info())
+ # Install items into the misc_ namespace, used by products
+ # and the framework itself to store common static resources
+ # like icon images.
+ misc_=pgetattr(product, 'misc_', {})
+ if misc_:
+ if type(misc_) is DictType:
+ misc_=Misc_(product_name, misc_)
+ Application.misc_.__dict__[product_name]=misc_
+
+ # Here we create a ProductContext object which contains
+ # information about the product and provides an interface
+ # for registering things like classes and help topics that
+ # should be associated with that product. Products are
+ # expected to implement a method named 'initialize' in
+ # their __init__.py that takes the ProductContext as an
+ # argument.
+ productObject=App.Product.initializeProduct(
+ product, product_name, package_dir, app)
+ context=ProductContext(productObject, app, product)
+
+ # Look for an 'initialize' method in the product. If it does
+ # not exist, then this is an old product that has never been
+ # updated. In that case, we will analyze the product and
+ # build up enough information to do initialization manually.
+ initmethod=pgetattr(product, 'initialize', None)
+ if initmethod is not None:
+ initmethod(context)
+
+ # Support old-style product metadata. Older products may
+ # define attributes to name their permissions, meta_types,
+ # constructors, etc.
+ permissions={}
+ new_permissions={}
+ for p in pgetattr(product, '__ac_permissions__', ()):
+ permission, names, default = (
+ tuple(p)+('Manager',))[:3]
+ if names:
+ for name in names:
+ permissions[name]=permission
+ elif not folder_permissions.has_key(permission):
+ new_permissions[permission]=()
+
+ for meta_type in pgetattr(product, 'meta_types', ()):
+ # Modern product initialization via a ProductContext
+ # adds 'product' and 'permission' keys to the meta_type
+ # mapping. We have to add these here for old products.
+ pname=permissions.get(meta_type['action'], None)
+ if pname is not None:
+ meta_type['permission']=pname
+ meta_type['product']=productObject.id
+ meta_type['visibility'] = 'Global'
+ meta_types.append(meta_type)
+
+ for name,method in pgetattr(
+ product, 'methods', {}).items():
+ if not hasattr(Folder.Folder, name):
+ setattr(Folder.Folder, name, method)
+ if name[-9:]!='__roles__': # not Just setting roles
+ if (permissions.has_key(name) and
+ not folder_permissions.has_key(
+ permissions[name])):
+ permission=permissions[name]
+ if new_permissions.has_key(permission):
+ new_permissions[permission].append(name)
+ else:
+ new_permissions[permission]=[name]
+
+ if new_permissions:
+ new_permissions=new_permissions.items()
+ for permission, names in new_permissions:
+ folder_permissions[permission]=names
+ new_permissions.sort()
+ Folder.Folder.__dict__['__ac_permissions__']=tuple(
+ list(Folder.Folder.__ac_permissions__)+new_permissions)
+
+ if (os.environ.get('ZEO_CLIENT') and
+ not os.environ.get('FORCE_PRODUCT_LOAD')):
+ # we don't want to install products from clients
+ # (unless FORCE_PRODUCT_LOAD is defined).
get_transaction().abort()
- if raise_exc:
- raise
+ else:
+ get_transaction().note('Installed product '+product_name)
+ get_transaction().commit()
+
+ except:
+ if log_exc:
+ LOG('Zope',ERROR,'Couldn\'t install %s' % product_name,
+ error=sys.exc_info())
+ get_transaction().abort()
+ if raise_exc:
+ raise
def install_standards(app):
# Check to see if we've already done this before
# Don't do it twice (Casey)
if getattr(app, '_standard_objects_have_been_added', 0):
return
-
+
# Install the replaceable standard objects
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
std_dir = os.path.join(Globals.package_home(globals()), 'standard')
=== Zope/lib/python/OFS/Cache.py 1.9 => 1.10 ===
--- Zope/lib/python/OFS/Cache.py:1.9 Thu Feb 7 12:20:59 2002
+++ Zope/lib/python/OFS/Cache.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
__doc__="""Cacheable object and cache management base classes.
=== Zope/lib/python/OFS/CopySupport.py 1.81 => 1.82 ===
--- Zope/lib/python/OFS/CopySupport.py:1.81 Wed Aug 14 11:22:11 2002
+++ Zope/lib/python/OFS/CopySupport.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
__doc__="""Copy interface"""
__version__='$Revision$'[11:-2]
@@ -77,7 +77,7 @@
REQUEST['__cp'] = cp
return self.manage_main(self, REQUEST)
return cp
-
+
def manage_copyObjects(self, ids=None, REQUEST=None, RESPONSE=None):
"""Put a reference to the objects named in ids in the clip board"""
if ids is None and REQUEST is not None:
@@ -130,7 +130,7 @@
cp=REQUEST['__cp']
if cp is None:
raise CopyError, eNoData
-
+
try: cp=_cb_decode(cp)
except: raise CopyError, eInvalid
@@ -186,7 +186,7 @@
# try to make ownership explicit so that it gets carried
# along to the new location if needed.
ob.manage_changeOwnershipType(explicit=1)
-
+
aq_parent(aq_inner(ob))._delObject(id)
ob = aq_base(ob)
orig_id=id
@@ -232,7 +232,7 @@
action ='manage_main')
ob=self._getOb(id)
if not ob.cb_isMoveable():
- raise CopyError, eNotSupported % id
+ raise CopyError, eNotSupported % id
self._verifyObjectPaste(ob)
try: ob._notifyOfCopyTo(self, op=1)
except: raise CopyError, MessageDialog(
@@ -242,7 +242,7 @@
self._delObject(id)
ob = aq_base(ob)
ob._setId(new_id)
-
+
# Note - because a rename always keeps the same context, we
# can just leave the ownership info unchanged.
self._setObject(new_id, ob, set_owner=0)
@@ -308,7 +308,7 @@
#
# Passing a false value for the validate_src argument will skip
# checking the passed in object in its existing context. This is
- # mainly useful for situations where the passed in object has no
+ # mainly useful for situations where the passed in object has no
# existing context, such as checking an object during an import
# (the object will not yet have been connected to the acquisition
# heirarchy).
@@ -390,7 +390,7 @@
__ac_permissions__=(
('Copy or Move', (), ('Anonymous', 'Manager',)),
)
-
+
def _canCopy(self, op=0):
"""Called to make sure this object is copyable. The op var
is 0 for a copy, 1 for a move."""
@@ -430,7 +430,7 @@
# Called after the copy is finished to accomodate special cases.
# The op var is 0 for a copy, 1 for a move.
pass
-
+
def _setId(self, id):
# Called to set the new id of a copied object.
self.id=id
=== Zope/lib/python/OFS/DTMLDocument.py 1.47 => 1.48 ===
--- Zope/lib/python/OFS/DTMLDocument.py:1.47 Fri Apr 12 11:37:13 2002
+++ Zope/lib/python/OFS/DTMLDocument.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""DTML Document objects."""
@@ -87,12 +87,12 @@
if self.wl_isLocked():
raise ResourceLockedError, (
'This document has been locked via WebDAV.')
-
- if type(file) is not type(''):
- if REQUEST and not file:
+
+ if type(file) is not type(''):
+ if REQUEST and not file:
raise ValueError, 'No file specified'
file=file.read()
-
+
self.munge(file)
self.ZCacheable_invalidate()
if REQUEST:
@@ -114,7 +114,7 @@
if hasattr(self, 'aq_explicit'):
bself=self.aq_explicit
else: bself=self
-
+
security=getSecurityManager()
security.addContext(self)
@@ -178,5 +178,3 @@
if submit==" Add and Edit ": u="%s/%s" % (u,quote(id))
REQUEST.RESPONSE.redirect(u+'/manage_main')
return ''
-
-
=== Zope/lib/python/OFS/DTMLMethod.py 1.78 => 1.79 ===
--- Zope/lib/python/OFS/DTMLMethod.py:1.78 Fri Apr 19 10:27:41 2002
+++ Zope/lib/python/OFS/DTMLMethod.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""DTML Method objects."""
@@ -101,7 +101,7 @@
if data is not _marker:
# Return cached results.
return data
-
+
kw['document_id'] =self.getId()
kw['document_title']=self.title
@@ -113,7 +113,7 @@
self.__dict__['validate'] = security.DTMLValidate
first_time_through = 1
try:
-
+
if client is None:
# Called as subtemplate, so don't need error propagation!
r=apply(HTML.__call__, (self, client, REQUEST), kw)
@@ -179,7 +179,7 @@
Returns the cacheNamespaceKeys.
'''
return self._cache_namespace_keys
-
+
def setCacheNamespaceKeys(self, keys, REQUEST=None):
'''
Sets the list of names that should be looked up in the
@@ -220,14 +220,14 @@
def _er(self,data,title,SUBMIT,dtpref_cols,dtpref_rows,REQUEST):
dr,dc = self._size_changes[SUBMIT]
-
+
rows=str(max(1,int(dtpref_rows)+dr))
-
+
if dtpref_cols[-1]=='%':
cols= str(min(100, max(25,int(dtpref_cols[:-1])+dc)))+'%'
else:
cols=str(max(35,int(dtpref_cols)+dc))
-
+
e=(DateTime('GMT') + 365).rfc822()
resp=REQUEST['RESPONSE']
resp.setCookie('dtpref_rows',str(rows),path='/',expires=e)
@@ -267,11 +267,11 @@
if self.wl_isLocked():
raise ResourceLockedError, 'This DTML Method is locked via WebDAV'
- if type(file) is not type(''):
- if REQUEST and not file:
+ if type(file) is not type(''):
+ if REQUEST and not file:
raise ValueError, 'No file specified'
file=file.read()
-
+
self.munge(file)
self.ZCacheable_invalidate()
if REQUEST:
@@ -297,7 +297,7 @@
raise 'Forbidden', (
'You are not authorized to change <em>%s</em> because you '
'do not have proxy roles.\n<!--%s, %s-->' % (self.__name__, u, roles))
-
+
def manage_proxy(self, roles=(), REQUEST=None):
"Change Proxy Roles"
@@ -368,11 +368,11 @@
headers.append(header)
spos = m.end() + 1
while spos < len(html) and html[spos] in ' \t':
- eol = find(html, '\r\n', spos)
+ eol = find(html, '\r\n', spos)
if eol <> -1:
eolen = 2
else:
- eol = find(html, '\n', spos)
+ eol = find(html, '\n', spos)
if eol < 0: return html
eolen = 1
header.append(strip(html[spos:eol]))
@@ -387,7 +387,7 @@
default_dm_html="""<dtml-var standard_html_header>
<h2><dtml-var title_or_id> <dtml-var document_title></h2>
<p>
-This is the <dtml-var document_id> Document
+This is the <dtml-var document_id> Document
in the <dtml-var title_and_id> Folder.
</p>
<dtml-var standard_html_footer>"""
@@ -411,4 +411,3 @@
if submit==" Add and Edit ": u="%s/%s" % (u,quote(id))
REQUEST.RESPONSE.redirect(u+'/manage_main')
return ''
-
=== Zope/lib/python/OFS/DefaultObservable.py 1.5 => 1.6 ===
--- Zope/lib/python/OFS/DefaultObservable.py:1.5 Thu Feb 7 12:20:59 2002
+++ Zope/lib/python/OFS/DefaultObservable.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
__doc__="""Implement Observable interface (see
http://www.zope.org/Members/michel/Projects/Interfaces/ObserverAndNotification)
@@ -57,12 +57,12 @@
def __init__( self, debug=0 ):
self._observers = []
self._debug = debug
-
+
def _normalize( self, observer ):
# Assert that observer is a string or a sequence of strings.
if type( observer ) != StringType:
- observer = '/'.join( observer)
+ observer = '/'.join( observer)
return observer
@@ -102,13 +102,13 @@
traceback.print_exc()
else:
bozos.append( observer )
-
+
for bozo in bozos:
try: # avoid race condition if unregister() called before now
self._observers.remove( bozo )
except:
pass
-
+
#
# Unit tests
@@ -117,7 +117,7 @@
if __name__ == '__main__':
class DontGoHere( Exception ): pass
-
+
class TestSubject( DefaultObservable ):
def __init__( self, paths ):
@@ -134,29 +134,29 @@
if cbrec is None:
cbrec = callbacks[ name ] = []
cbrec.append( ( subject, event ) )
-
+
class TestObserver:
def __call__( self, subject, event ):
recordCallback( 'direct', subject, event )
-
+
def namedCallback( self, subject, event ):
recordCallback( 'named', subject, event )
-
+
def named2Callback( self, subject, event ):
recordCallback( 'named2', subject, event )
-
+
def boundCallback( self, subject, event ):
recordCallback( 'bound', subject, event )
def freefuncObserver( subject, event ):
- recordCallback( 'freefunc', subject, event )
-
+ recordCallback( 'freefunc', subject, event )
+
def tryVeto( subject, event ):
""" Simulate attempted veto. """
raise 'Idawanna!'
-
+
observer = TestObserver()
# Simulate Zope's path traversal mechanism.
@@ -204,4 +204,3 @@
print '[%s]' % key
for cb in callbacks[ key ]:
print ' %s' % `cb`
-
=== Zope/lib/python/OFS/Document.py 1.75 => 1.76 ===
--- Zope/lib/python/OFS/Document.py:1.75 Wed Nov 28 10:50:57 2001
+++ Zope/lib/python/OFS/Document.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""Deprecated - use DTMLMethod"""
=== Zope/lib/python/OFS/FTPInterface.py 1.3 => 1.4 ===
--- Zope/lib/python/OFS/FTPInterface.py:1.3 Wed Nov 28 10:50:57 2001
+++ Zope/lib/python/OFS/FTPInterface.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""FTP Support for Zope classes.
@@ -23,11 +23,11 @@
class FTPInterface:
"Interface for FTP objects"
-
+
# XXX The stat and list marshal format should probably
# be XML, not marshal, maybe Andrew K's xml-marshal.
# This will probably be changed later.
-
+
def manage_FTPstat(self,REQUEST):
"""Returns a stat-like tuple. (marshalled to a string) Used by
FTP for directory listings, and MDTM and SIZE"""
@@ -37,13 +37,13 @@
(id,stat) tuples, marshaled to a string. Note, the listing it
should include '..' if there is a Folder above the current
one.
-
+
In the case of non-foldoid objects it should return a single
tuple (id,stat) representing itself."""
-
+
# Optional method to support FTP download.
# Should not be implemented by Foldoid objects.
-
+
def manage_FTPget(self):
"""Returns the source content of an object. For example, the
source text of a Document, or the data of a file."""
=== Zope/lib/python/OFS/FindSupport.py 1.30 => 1.31 ===
--- Zope/lib/python/OFS/FindSupport.py:1.30 Thu Mar 28 14:59:00 2002
+++ Zope/lib/python/OFS/FindSupport.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
__doc__="""Find support"""
__version__='$Revision$'[11:-2]
@@ -42,10 +42,10 @@
('manage_findFrame', 'manage_findForm', 'manage_findAdv',
'manage_findResult')),
)
-
+
manage_options=(
- {'label':'Find', 'action':'manage_findForm',
- 'help':('OFSP','Find.stx')},
+ {'label':'Find', 'action':'manage_findForm',
+ 'help':('OFSP','Find.stx')},
)
def ZopeFind(self, obj, obj_ids=None, obj_metatypes=None,
@@ -61,7 +61,7 @@
if obj_metatypes and 'all' in obj_metatypes:
obj_metatypes=None
-
+
if obj_mtime and type(obj_mtime)==type('s'):
obj_mtime=DateTime(obj_mtime).timeTime()
@@ -70,7 +70,7 @@
if obj_roles and type(obj_roles) is type('s'):
obj_roles=[obj_roles]
-
+
if obj_expr:
# Setup expr machinations
md=td()
@@ -97,7 +97,7 @@
for id, ob in items:
if pre: p="%s/%s" % (pre, id)
else: p=id
-
+
dflag=0
if hasattr(ob, '_p_changed') and (ob._p_changed == None):
dflag=1
@@ -148,9 +148,9 @@
-
+
PrincipiaFind=ZopeFind
-
+
def ZopeFindAndApply(self, obj, obj_ids=None, obj_metatypes=None,
obj_searchterm=None, obj_expr=None,
obj_mtime=None, obj_mspec=None,
@@ -165,7 +165,7 @@
if obj_metatypes and 'all' in obj_metatypes:
obj_metatypes=None
-
+
if obj_mtime and type(obj_mtime)==type('s'):
obj_mtime=DateTime(obj_mtime).timeTime()
@@ -174,7 +174,7 @@
if obj_roles and type(obj_roles) is type('s'):
obj_roles=[obj_roles]
-
+
if obj_expr:
# Setup expr machinations
md=td()
@@ -196,7 +196,7 @@
for id, ob in items:
if pre: p="%s/%s" % (pre, id)
else: p=id
-
+
dflag=0
if hasattr(ob, '_p_changed') and (ob._p_changed == None):
dflag=1
@@ -229,7 +229,7 @@
else:
add_result((p, ob))
dflag=0
-
+
if search_sub and hasattr(bs, 'objectItems'):
self.ZopeFindAndApply(ob, obj_ids, obj_metatypes,
obj_searchterm, obj_expr,
@@ -261,14 +261,14 @@
def mtime_match(ob, t, q, fn=hasattr):
if not fn(ob, '_p_mtime'):
- return 0
+ return 0
return q=='<' and (ob._p_mtime < t) or (ob._p_mtime > t)
def role_match(ob, permission, roles, lt=type([]), tt=type(())):
pr=[]
fn=pr.append
-
+
while 1:
if hasattr(ob, permission):
p=getattr(ob, permission)
@@ -307,5 +307,3 @@
def p_name(name):
return '_' + translate(name, name_trans) + '_Permission'
-
-
=== Zope/lib/python/OFS/Folder.py 1.100 => 1.101 ===
--- Zope/lib/python/OFS/Folder.py:1.100 Fri Jun 7 14:10:31 2002
+++ Zope/lib/python/OFS/Folder.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""Folder object
@@ -46,7 +46,7 @@
self._setObject(id, ob)
ob=self._getOb(id)
- checkPermission=getSecurityManager().checkPermission
+ checkPermission=getSecurityManager().checkPermission
if createUserF:
if not checkPermission('Add User Folders', ob):
@@ -61,7 +61,7 @@
'You are not authorized to add Page Templates.'
)
ob.manage_addProduct['PageTemplates'].manage_addPageTemplate(
- id='index_html', title='')
+ id='index_html', title='')
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1)
=== Zope/lib/python/OFS/History.py 1.13 => 1.14 ===
--- Zope/lib/python/OFS/History.py:1.13 Mon Mar 11 10:31:02 2002
+++ Zope/lib/python/OFS/History.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""Object Histories"""
@@ -92,7 +92,7 @@
)
),
)
-
+
manage_options=({'label':'History', 'action':'manage_change_history_page',
'help':('OFSP','History.stx')
},
@@ -110,7 +110,7 @@
if request is not None:
first=request.get('first_transaction', first)
last=request.get('last_transaction',last)
-
+
r=self._p_jar.db().history(self._p_oid, None, last)
r=r[first:]
@@ -146,7 +146,7 @@
base._p_deactivate()
base.__setstate__(state)
base._p_changed=1
-
+
self.manage_afterHistoryCopy()
if RESPONSE is not None and URL1 is not None:
@@ -154,7 +154,7 @@
def manage_afterHistoryCopy(self): pass # ? (Hook)
-
+
_manage_historyComparePage=Globals.DTMLFile(
'dtml/historyCompare', globals(), management_view='History')
def manage_historyCompare(self, rev1, rev2, REQUEST,
@@ -174,10 +174,10 @@
if len(keys) > 2:
raise HistorySelectionError, (
"Only two historical revision can be compared<p>")
-
+
serial=apply(pack, ('>HHHH',)+tuple(map(int, keys[-1].split('.'))))
rev1=historicalRevision(self, serial)
-
+
if len(keys)==2:
serial=apply(pack,
('>HHHH',)+tuple(map(int, keys[0].split('.'))))
@@ -187,7 +187,7 @@
rev2=self
return self.manage_historyCompare(rev1, rev2, REQUEST)
-
+
Globals.default__class_init__(Historical)
def dump(tag, x, lo, hi, r):
=== Zope/lib/python/OFS/Image.py 1.139 => 1.140 ===
--- Zope/lib/python/OFS/Image.py:1.139 Wed Aug 14 11:07:56 2002
+++ Zope/lib/python/OFS/Image.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""Image object"""
@@ -45,7 +45,7 @@
title=str(title)
content_type=str(content_type)
precondition=str(precondition)
-
+
id, title = cookId(id, title, file)
self=self.this()
@@ -66,11 +66,11 @@
class File(Persistent, Implicit, PropertyManager,
RoleManager, Item_w__name__, Cacheable):
"""A File object is a content object for arbitrary files."""
-
+
__implements__ = (WriteLockInterface, HTTPRangeSupport.HTTPRangeInterface)
meta_type='File'
-
+
precondition=''
size=None
@@ -79,7 +79,7 @@
manage_editForm._setName('manage_editForm')
manage=manage_main=manage_editForm
manage_uploadForm=manage_editForm
-
+
manage_options=(
(
{'label':'Edit', 'action':'manage_main',
@@ -107,7 +107,7 @@
('Delete objects',
('DELETE',)),
)
-
+
_properties=({'id':'title', 'type': 'string'},
{'id':'content_type', 'type':'string'},
@@ -117,7 +117,7 @@
self.__name__=id
self.title=title
self.precondition=precondition
-
+
data, size = self._read_data(file)
content_type=self._get_content_type(file, data, id, content_type)
self.update_data(data, content_type, size)
@@ -162,8 +162,8 @@
return ''
if self.precondition and hasattr(self,self.precondition):
- # Grab whatever precondition was defined and then
- # execute it. The precondition will raise an exception
+ # Grab whatever precondition was defined and then
+ # execute it. The precondition will raise an exception
# if something violates its terms.
c=getattr(self,self.precondition)
if hasattr(c,'isDocTemp') and c.isDocTemp:
@@ -217,7 +217,7 @@
break
if not satisfiable:
- RESPONSE.setHeader('Content-Range',
+ RESPONSE.setHeader('Content-Range',
'bytes */%d' % self.size)
RESPONSE.setHeader('Accept-Ranges', 'bytes')
RESPONSE.setHeader('Last-Modified',
@@ -229,18 +229,18 @@
# Can we optimize?
ranges = HTTPRangeSupport.optimizeRanges(ranges, self.size)
-
+
if len(ranges) == 1:
# Easy case, set extra header and return partial set.
start, end = ranges[0]
size = end - start
-
+
RESPONSE.setHeader('Last-Modified',
rfc1123_date(self._p_mtime))
RESPONSE.setHeader('Content-Type', self.content_type)
RESPONSE.setHeader('Content-Length', size)
RESPONSE.setHeader('Accept-Ranges', 'bytes')
- RESPONSE.setHeader('Content-Range',
+ RESPONSE.setHeader('Content-Range',
'bytes %d-%d/%d' % (start, end - 1, self.size))
RESPONSE.setStatus(206) # Partial content
@@ -258,11 +258,11 @@
lstart = l - (pos - start)
if lstart < 0: lstart = 0
-
+
# find the endpoint
if end <= pos:
lend = l - (pos - end)
-
+
# Send and end transmission
RESPONSE.write(data[lstart:lend])
break
@@ -271,26 +271,26 @@
RESPONSE.write(data[lstart:])
data = data.next
-
+
return ''
-
+
else:
# When we get here, ranges have been optimized, so they are
# in order, non-overlapping, and start and end values are
# positive integers.
boundary = choose_boundary()
-
+
# Calculate the content length
size = (8 + len(boundary) + # End marker length
len(ranges) * ( # Constant lenght per set
- 49 + len(boundary) + len(self.content_type) +
+ 49 + len(boundary) + len(self.content_type) +
len('%d' % self.size)))
for start, end in ranges:
# Variable length per set
- size = (size + len('%d%d' % (start, end - 1)) +
+ size = (size + len('%d%d' % (start, end - 1)) +
end - start)
-
-
+
+
# Some clients implement an earlier draft of the spec, they
# will only accept x-byteranges.
draftprefix = (request_range is not None) and 'x-' or ''
@@ -313,7 +313,7 @@
self.content_type)
RESPONSE.write(
'Content-Range: bytes %d-%d/%d\r\n\r\n' % (
- start, end - 1, self.size))
+ start, end - 1, self.size))
if type(data) is StringType:
RESPONSE.write(data[start:end])
@@ -328,11 +328,11 @@
lstart = l - (pos - start)
if lstart < 0: lstart = 0
-
+
# find the endpoint
if end <= pos:
lend = l - (pos - end)
-
+
# Send and loop to next range
RESPONSE.write(data[lstart:lend])
# Back up the position marker, it will
@@ -420,7 +420,7 @@
if REQUEST:
message="Saved changes."
return self.manage_main(self,REQUEST,manage_tabs_message=message)
-
+
def _get_content_type(self, file, body, id, content_type=None):
headers=getattr(file, 'headers', None)
if headers and headers.has_key('content-type'):
@@ -432,9 +432,9 @@
return content_type
def _read_data(self, file):
-
+
n=1 << 16
-
+
if type(file) is StringType:
size=len(file)
if size < n: return file, size
@@ -448,7 +448,7 @@
seek=file.seek
read=file.read
-
+
seek(0,2)
size=end=file.tell()
@@ -460,9 +460,9 @@
# Make sure we have an _p_jar, even if we are a new object, by
# doing a sub-transaction commit.
get_transaction().commit(1)
-
+
jar=self._p_jar
-
+
if jar is None:
# Ugh
seek(0)
@@ -478,7 +478,7 @@
if pos < n: pos=0 # we always want at least n bytes
seek(pos)
data=Pdata(read(end-pos))
-
+
# Woooop Woooop Woooop! This is a trick.
# We stuff the data directly into our jar to reduce the
# number of updates necessary.
@@ -487,17 +487,17 @@
# This is needed and has side benefit of getting
# the thing registered:
data.next=next
-
+
# Now make it get saved in a sub-transaction!
get_transaction().commit(1)
# Now make it a ghost to free the memory. We
# don't need it anymore!
data._p_changed=None
-
+
next=data
end=pos
-
+
return next, size
def PUT(self, REQUEST, RESPONSE):
@@ -507,7 +507,7 @@
type=REQUEST.get_header('content-type', None)
file=REQUEST['BODYFILE']
-
+
data, size = self._read_data(file)
content_type=self._get_content_type(file, data, self.__name__,
type or self.content_type)
@@ -515,7 +515,7 @@
RESPONSE.setStatus(204)
return RESPONSE
-
+
def get_size(self):
"""Get the size of a file or image.
@@ -538,7 +538,7 @@
def __str__(self): return str(self.data)
def __len__(self): return 1
-
+
manage_FTPget=index_html
@@ -563,13 +563,13 @@
# First, we create the image without data:
self._setObject(id, Image(id,title,'',content_type, precondition))
-
+
# Now we "upload" the data. By doing this in two steps, we
# can use a database trick to make the upload more efficient.
self._getOb(id).manage_upload(file)
if content_type:
self._getOb(id).content_type=content_type
-
+
if REQUEST is not None:
try: url=self.DestinationURL()
except: url=REQUEST['URL1']
@@ -584,7 +584,7 @@
width = -1
content_type = ''
- # handle GIFs
+ # handle GIFs
if (size >= 10) and data[:6] in ('GIF87a', 'GIF89a'):
# Check to see if content_type is correct
content_type = 'image/gif'
@@ -601,7 +601,7 @@
w, h = struct.unpack(">LL", data[16:24])
width = int(w)
height = int(h)
-
+
# Maybe this is for an older PNG version.
elif (size >= 16) and (data[:8] == '\211PNG\r\n\032\n'):
# Check to see if we have the right content type
@@ -642,7 +642,7 @@
__implements__ = (WriteLockInterface,)
meta_type='Image'
-
+
height=''
width=''
@@ -683,7 +683,7 @@
manage_editForm._setName('manage_editForm')
manage=manage_main=manage_editForm
manage_uploadForm=manage_editForm
-
+
# private
update_data__roles__=()
def update_data(self, data, content_type=None, size=None):
@@ -773,14 +773,14 @@
id=filename[max(filename.rfind('/'),
filename.rfind('\\'),
filename.rfind(':'),
- )+1:]
+ )+1:]
return id, title
class Pdata(Persistent, Implicit):
# Wrapper for possibly large data
next=None
-
+
def __init__(self, data):
self.data=data
@@ -800,14 +800,5 @@
self=next
r.append(self.data)
next=self.next
-
- return ''.join(r)
-
-
-
-
-
-
-
-
+ return ''.join(r)
=== Zope/lib/python/OFS/Moniker.py 1.15 => 1.16 ===
--- Zope/lib/python/OFS/Moniker.py:1.15 Thu Feb 7 12:20:59 2002
+++ Zope/lib/python/OFS/Moniker.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""Object monikers
@@ -28,7 +28,7 @@
persistent object. A moniker can be turned back into
a real object that retains its correct version context
and acquisition relationships via a simple interface."""
-
+
def __init__(self, ob=None):
if ob is None: return
self.idpath = ob.getPhysicalPath()
=== Zope/lib/python/OFS/ObjectManager.py 1.157 => 1.158 ===
--- Zope/lib/python/OFS/ObjectManager.py:1.157 Wed Aug 14 15:59:18 2002
+++ Zope/lib/python/OFS/ObjectManager.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
__doc__="""Object Manager
@@ -102,7 +102,7 @@
):
"""Generic object manager
- This class provides core behavior for collections of heterogeneous objects.
+ This class provides core behavior for collections of heterogeneous objects.
"""
__ac_permissions__=(
@@ -123,7 +123,7 @@
meta_type ='Object Manager'
meta_types=() # Sub-object types that are specific to this object
-
+
_objects =()
manage_main=DTMLFile('dtml/main', globals())
@@ -148,7 +148,7 @@
except: pass
mt.sort()
self.meta_types=tuple(mt)
-
+
default__class_init__(self)
def all_meta_types(self, interfaces=None):
@@ -179,11 +179,11 @@
eil = entry.get('interfaces',None)
if eil is not None:
for ei in eil:
- for i in interfaces:
+ for i in interfaces:
if ei is i or ei.extends(i):
- interface_constrained_meta_types.append(entry)
+ interface_constrained_meta_types.append(entry)
raise BreakoutException # only append 1ce
- except BreakoutException:
+ except BreakoutException:
pass
# Meta types specified by this instance are not checked against the
@@ -316,7 +316,7 @@
self._objects=tuple(filter(lambda i,n=id: i['id']!=n, self._objects))
self._delOb(id)
- # Indicate to the object that it has been deleted. This is
+ # Indicate to the object that it has been deleted. This is
# necessary for object DB mount points. Note that we have to
# tolerate failure here because the object being deleted could
# be a Broken object, and it is not possible to set attributes
@@ -410,7 +410,7 @@
vals.append(get(id))
seen[physicalPath]=1
except: pass
-
+
if hasattr(obj,'aq_parent'):
obj=obj.aq_parent
relativePhysicalPath = ('..',) + relativePhysicalPath
@@ -424,7 +424,7 @@
def manage_delObjects(self, ids=[], REQUEST=None):
"""Delete a subordinate object
-
+
The objects specified in 'ids' get deleted.
"""
if type(ids) is type(''): ids=[ids]
@@ -447,7 +447,7 @@
self._delObject(id)
del ids[-1]
if REQUEST is not None:
- return self.manage_main(self, REQUEST, update_menu=1)
+ return self.manage_main(self, REQUEST, update_menu=1)
def tpValues(self):
@@ -475,7 +475,7 @@
def manage_exportObject(self, id='', download=None, toxml=None,
RESPONSE=None,REQUEST=None):
- """Exports an object to a file and returns that file."""
+ """Exports an object to a file and returns that file."""
if not id:
# can't use getId() here (breaks on "old" exported objects)
id=self.id
@@ -484,7 +484,7 @@
else: ob=self._getOb(id)
suffix=toxml and 'xml' or 'zexp'
-
+
if download:
f=StringIO()
if toxml: XMLExportImport.exportXML(ob._p_jar, ob._p_oid, f)
@@ -502,7 +502,7 @@
ob._p_jar.exportFile(ob._p_oid, f)
if REQUEST is not None:
- return self.manage_main(self, REQUEST,
+ return self.manage_main(self, REQUEST,
manage_tabs_message=
'<em>%s</em> sucessfully exported to <em>%s</em>' % (id,f),
title = 'Object exported')
@@ -518,7 +518,7 @@
instance_home = INSTANCE_HOME
zope_home = ZOPE_HOME
-
+
for impath in (instance_home, zope_home):
filepath = os.path.join(impath, 'import', file)
if os.path.exists(filepath):
@@ -528,9 +528,9 @@
self._importObjectFromFile(filepath, verify=not not REQUEST,
set_owner=set_owner)
-
+
if REQUEST is not None:
- return self.manage_main(self, REQUEST,
+ return self.manage_main(self, REQUEST,
manage_tabs_message='<em>%s</em> sucessfully imported' % id,
title = 'Object imported',
update_menu=1)
@@ -556,7 +556,7 @@
ob.manage_changeOwnershipType(explicit=0)
# FTP support methods
-
+
def manage_FTPlist(self, REQUEST):
"Directory listing for FTP"
out=()
@@ -569,7 +569,7 @@
if not hasattr(ob,'aq_parent'):
break
ob=ob.aq_parent
-
+
files=self.objectItems()
# recursive ride through all subfolders (ls -R) (ajung)
@@ -582,7 +582,7 @@
all_files.extend(findChilds(f[1]))
else:
all_files.append(f)
-
+
files = all_files
try:
@@ -592,7 +592,7 @@
files.sort()
# Perform globbing on list of files (ajung)
-
+
globbing = REQUEST.environ.get('GLOBBING','')
if globbing :
files = filter(lambda x,g=globbing: fnmatch.fnmatch(x[0],g) , files)
@@ -602,7 +602,7 @@
except AttributeError:
files=list(files)
files.sort()
-
+
if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and
self.isTopLevelPrincipiaApplicationObject):
files.insert(0,('..',self.aq_parent))
@@ -614,7 +614,7 @@
except: stat=None
if stat is not None:
out=out+((k,stat),)
- return marshal.dumps(out)
+ return marshal.dumps(out)
def manage_FTPstat(self,REQUEST):
"Psuedo stat used for FTP listings"
=== Zope/lib/python/OFS/PropertyManager.py 1.45 => 1.46 ===
--- Zope/lib/python/OFS/PropertyManager.py:1.45 Thu Aug 1 12:00:39 2002
+++ Zope/lib/python/OFS/PropertyManager.py Wed Aug 14 17:42:56 2002
@@ -1,5 +1,5 @@
##############################################################################
-#
+#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
@@ -8,7 +8,7 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Property management"""
@@ -90,9 +90,9 @@
manage_options=(
{'label':'Properties', 'action':'manage_propertiesForm',
- 'help':('OFSP','Properties.stx')},
+ 'help':('OFSP','Properties.stx')},
)
-
+
manage_propertiesForm=DTMLFile('dtml/properties', globals(),
property_extensible_schema__=1)
manage_propertyTypeForm=DTMLFile('dtml/propertyType', globals())
@@ -134,7 +134,7 @@
return 0
def getProperty(self, id, d=None):
- """Get the property 'id', returning the optional second
+ """Get the property 'id', returning the optional second
argument or None if no such property is found."""
if self.hasProperty(id):
return getattr(self, id)
@@ -165,7 +165,7 @@
# for selection and multiple selection properties
# the value argument indicates the select variable
# of the property
-
+
self._wrapperCheck(value)
if not self.valid_property_id(id):
raise 'Bad Request', 'Invalid or duplicate property id'
@@ -213,7 +213,7 @@
def propertyItems(self):
"""Return a list of (id,property) tuples """
- return map(lambda i,s=self: (i['id'],getattr(s,i['id'])),
+ return map(lambda i,s=self: (i['id'],getattr(s,i['id'])),
self._properties)
def _propertyMap(self):
"""Return a tuple of mappings, giving meta-data for properties """
@@ -289,7 +289,7 @@
return self.manage_propertiesForm(self,REQUEST,manage_tabs_message=message)
# Note - this is experimental, pending some community input.
-
+
def manage_changePropertyTypes(self, old_ids, props, REQUEST=None):
"""Replace one set of properties with another
@@ -307,7 +307,7 @@
self._setProperty(prop.new_id, prop.new_value, prop.new_type)
if REQUEST is not None:
return self.manage_propertiesForm(self, REQUEST)
-
+
def manage_delProperties(self, ids=None, REQUEST=None):
"""Delete one or more properties specified by 'ids'."""
=== Zope/lib/python/OFS/PropertySheets.py 1.86 => 1.87 ===
--- Zope/lib/python/OFS/PropertySheets.py:1.86 Wed Aug 14 12:54:34 2002
+++ Zope/lib/python/OFS/PropertySheets.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""Property sheets"""
@@ -43,7 +43,7 @@
RESPONSE.redirect(URL1+'/manage')
def tpURL(self): return self.getId()
-
+
def manage_options(self):
"""Return a manage option data structure for me instance
"""
@@ -58,7 +58,7 @@
if l >= 0:
pre=pre[:l]
pre=pre+'/'
-
+
r=[]
for d in self.aq_parent.aq_parent.manage_options:
path=d['action']
@@ -109,7 +109,7 @@
),
)
- __reserved_ids= ('values','items')
+ __reserved_ids= ('values','items')
def property_extensible_schema__(self):
"""Return a flag indicating whether new properties may be
@@ -195,7 +195,7 @@
if hasattr(aq_base(self),id):
if not (id=='title' and not self.__dict__.has_key(id)):
raise 'Bad Request', (
- 'Invalid property id, <em>%s</em>. It is in use.' %
+ 'Invalid property id, <em>%s</em>. It is in use.' %
escape(id))
if meta is None: meta={}
prop={'id':id, 'type':type, 'meta':meta}
@@ -261,7 +261,7 @@
def propertyItems(self):
# Return a list of (id, property) tuples.
- return map(lambda i, s=self: (i['id'], s.getProperty(i['id'])),
+ return map(lambda i, s=self: (i['id'], s.getProperty(i['id'])),
self._propertyMap())
def propertyInfo(self, id):
@@ -316,7 +316,7 @@
attrs=''.join(attrs)
else:
# Quote non-xml items here?
- attrs=''
+ attrs=''
if hasattr(self,"dav__"+name):
prop=' <n:%s%s>%s</n:%s>' % (name, attrs, value, name)
@@ -326,7 +326,7 @@
result.append(prop)
if not result: return ''
result='\n'.join(result)
-
+
return propstat % (self.xml_namespace(), result, '200 OK', '')
def dav__propnames(self, propstat=propstat):
@@ -375,7 +375,7 @@
if not result.has_key(code):
result[code]=[prop]
else: result[code].append(prop)
- return
+ return
del propstat
@@ -383,7 +383,7 @@
# Web interface
-
+
manage=DTMLFile('dtml/properties', globals())
def manage_propertiesForm(self, URL1):
" "
@@ -456,7 +456,7 @@
def __init__(self):
pass
-
+
def v_self(self):
return self.aq_parent.aq_parent
@@ -485,7 +485,7 @@
{'id':'supportedlock', 'mode':'r'},
{'id':'lockdiscovery', 'mode':'r'},
)
-
+
def getProperty(self, id, default=None):
method='dav__%s' % id
if not hasattr(self, method):
@@ -506,10 +506,10 @@
if hasattr(self.v_self(), '_p_mtime'):
return self.pm + ({'id':'getlastmodified', 'mode':'r'},)
return self.pm
-
+
def propertyMap(self):
return map(lambda dict: dict.copy(), self._propertyMap())
-
+
def dav__creationdate(self):
return iso8601_date(43200.0)
@@ -518,7 +518,7 @@
def dav__resourcetype(self):
vself=self.v_self()
- if (isDavCollection(vself) or
+ if (isDavCollection(vself) or
getattr(aq_base(vself), 'isAnObjectManager', None)):
return '<n:collection/>'
return ''
@@ -559,7 +559,7 @@
def dav__lockdiscovery(self):
security = getSecurityManager()
user = security.getUser().getUserName()
-
+
vself = self.v_self()
out = '\n'
@@ -570,9 +570,9 @@
creator = lock.getCreator()[-1]
if creator == user: fake=0
else: fake=1
-
+
out = '%s\n%s' % (out, lock.asLockDiscoveryProperty('n',fake=fake))
-
+
out = '%s\n' % out
return out
@@ -584,7 +584,7 @@
class PropertySheets(Traversable, Implicit, App.Management.Tabs):
"""A tricky container to keep property sets from polluting
an object's direct attribute namespace."""
-
+
id='propertysheets'
__ac_permissions__=(
@@ -603,7 +603,7 @@
webdav =DAVProperties()
def _get_defaults(self):
return (self.webdav,)
-
+
def __propsets__(self):
propsets=self.aq_parent.__propsets__
__traceback_info__= propsets, type(propsets)
@@ -631,7 +631,7 @@
r.append((id, n.__of__(self)))
return r
-
+
def get(self, name, default=None):
for propset in self.__propsets__():
if propset.id==name or (hasattr(propset, 'xml_namespace') and \
@@ -657,7 +657,7 @@
if propset.getId() != name and propset.xml_namespace() != name:
result.append(propset)
self.parent.__propsets__=tuple(result)
-
+
def __len__(self):
return len(self.__propsets__())
@@ -683,7 +683,7 @@
if l >= 0:
pre=pre[:l]
pre=pre+'/'
-
+
r=[]
for d in self.aq_parent.manage_options:
r.append({'label': d['label'], 'action': pre+d['action']})
@@ -734,7 +734,7 @@
if 'd' in mode:
d['mode']=filter(lambda c: c != 'd', mode)
r.append(d)
-
+
return tuple(r)
def propertyMap(self):
@@ -745,7 +745,7 @@
return self._base._extensible
Globals.default__class_init__(FixedSchema)
-
+
class vps(Base):
@@ -757,7 +757,7 @@
"""
def __init__(self, c=PropertySheets):
self.c=c
-
+
def __of__(self, parent):
return self.c().__of__(parent)
@@ -771,7 +771,7 @@
""" convert any content from ISO-8859-1 to UTF-8
The main use is to escape non-US object property values
(e.g. containing accented characters). Also we convert "<" and ">"
- to entities to keep the properties XML compliant.
+ to entities to keep the properties XML compliant.
"""
v = str(v)
v = v.replace('&', '&')
=== Zope/lib/python/OFS/SimpleItem.py 1.101 => 1.102 ===
--- Zope/lib/python/OFS/SimpleItem.py:1.101 Tue Jun 25 16:52:56 2002
+++ Zope/lib/python/OFS/SimpleItem.py Wed Aug 14 17:42:56 2002
@@ -1,21 +1,21 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
'''This module implements a simple item mix-in for objects that have a
very simple (e.g. one-screen) management interface, like documents,
Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new
-item types.
+item types.
$Id$'''
__version__='$Revision$'[11:-2]
@@ -49,7 +49,7 @@
"""A common base class for simple, non-container objects."""
isPrincipiaFolderish=0
isTopLevelPrincipiaApplicationObject=0
-
+
def manage_afterAdd(self, item, container): pass
def manage_beforeDelete(self, item, container): pass
def manage_afterClone(self, item): pass
@@ -81,17 +81,17 @@
# Meta type used for selecting all objects of a given type.
meta_type='simple item'
- # Default title.
+ # Default title.
title=''
# Default propertysheet info:
__propsets__=()
-
+
manage_options=(
App.Undo.UndoSupport.manage_options
+AccessControl.Owned.Owned.manage_options
)
-
+
# Attributes that must be acquired
REQUEST=Acquisition.Acquired
@@ -121,7 +121,7 @@
title=title()
id = self.getId()
return title and ("%s (%s)" % (title,id)) or id
-
+
def this(self):
# Handy way to talk to ourselves in document templates.
return self
@@ -147,7 +147,7 @@
try:
if error_type is None: error_type =sys.exc_info()[0]
if error_value is None: error_value=sys.exc_info()[1]
-
+
# allow for a few different traceback options
if tb is None and error_tb is None:
tb=sys.exc_info()[2]
@@ -171,7 +171,7 @@
# Stop if there is recursion.
raise error_type, error_value, tb
self._v_eek=1
-
+
if str(error_type).lower() in ('redirect',):
raise error_type, error_value, tb
@@ -227,7 +227,7 @@
def manage(self, URL1):
" "
- raise 'Redirect', "%s/manage_main" % URL1
+ raise 'Redirect', "%s/manage_main" % URL1
# This keeps simple items from acquiring their parents
# objectValues, etc., when used in simple tree tags.
@@ -236,14 +236,14 @@
objectIds=objectItems=objectValues
# FTP support methods
-
+
def manage_FTPstat(self,REQUEST):
"psuedo stat, used by FTP for directory listings"
from AccessControl.User import nobody
mode=0100000
-
+
# check read permissions
- if (hasattr(aq_base(self),'manage_FTPget') and
+ if (hasattr(aq_base(self),'manage_FTPget') and
hasattr(self.manage_FTPget, '__roles__')):
try:
if getSecurityManager().validateValue(self.manage_FTPget):
@@ -252,17 +252,17 @@
if nobody.allowed(self.manage_FTPget,
self.manage_FTPget.__roles__):
mode=mode | 0004
-
+
# check write permissions
if hasattr(aq_base(self),'PUT') and hasattr(self.PUT, '__roles__'):
try:
if getSecurityManager().validateValue(self.PUT):
mode=mode | 0220
except: pass
-
+
if nobody.allowed(self.PUT, self.PUT.__roles__):
mode=mode | 0002
-
+
# get size
if hasattr(aq_base(self), 'get_size'):
size=self.get_size()
@@ -295,7 +295,7 @@
if not hasattr(ob,'aq_parent'):
break
ob=ob.aq_parent
-
+
stat=marshal.loads(self.manage_FTPstat(REQUEST))
id = self.getId()
return marshal.dumps((id,stat))
@@ -331,11 +331,11 @@
and getPhysicalPath() are designed to operate together.
'''
path = (self.__name__,)
-
+
p = aq_parent(aq_inner(self))
- if p is not None:
+ if p is not None:
path = p.getPhysicalPath() + path
-
+
return path
@@ -358,7 +358,7 @@
'action':'manage_access',
'help':('OFSP', 'Security.stx')},
)
-
+
__ac_permissions__=(('View', ()),)
def __repr__(self):
@@ -385,4 +385,3 @@
res += ' used for %s' % context_path
res += '>'
return res
-
=== Zope/lib/python/OFS/Traversable.py 1.14 => 1.15 ===
--- Zope/lib/python/OFS/Traversable.py:1.14 Thu Feb 7 12:20:59 2002
+++ Zope/lib/python/OFS/Traversable.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
'''This module implements a mix-in for traversable objects.
@@ -57,9 +57,9 @@
and getPhysicalPath() are designed to operate together.
'''
path = (self.getId(),)
-
+
p = aq_parent(aq_inner(self))
- if p is not None:
+ if p is not None:
path = p.getPhysicalPath() + path
return path
@@ -94,7 +94,7 @@
self=self.getPhysicalRoot()
if (restricted and not securityManager.validateValue(self)):
raise Unauthorized, name
-
+
try:
object = self
while path:
@@ -127,7 +127,7 @@
if (not securityManager.validate(object,
container, name, o)):
raise Unauthorized, name
-
+
else:
o=get(object, name, M)
if o is not M:
@@ -142,7 +142,7 @@
if not securityManager.validate(
object, N, name, o):
raise Unauthorized, name
-
+
else:
o=object[name]
if (restricted and not securityManager.validate(
=== Zope/lib/python/OFS/Uninstalled.py 1.14 => 1.15 ===
--- Zope/lib/python/OFS/Uninstalled.py:1.14 Thu Aug 1 12:00:39 2002
+++ Zope/lib/python/OFS/Uninstalled.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""
Objects for packages that have been uninstalled.
@@ -23,7 +23,7 @@
broken_klasses={}
broken_klasses_lock = allocate_lock()
-class BrokenClass(Acquisition.Explicit, SimpleItem.Item,
+class BrokenClass(Acquisition.Explicit, SimpleItem.Item,
Persistence.Overridable):
_p_changed=0
meta_type='Broken Because Product is Gone'
@@ -47,7 +47,7 @@
manage=manage_main=Globals.DTMLFile('dtml/brokenEdit',globals())
manage_workspace=manage
-
+
def Broken(self, oid, pair):
broken_klasses_lock.acquire()
=== Zope/lib/python/OFS/XMLExportImport.py 1.3 => 1.4 ===
--- Zope/lib/python/OFS/XMLExportImport.py:1.3 Thu Feb 7 12:20:59 2002
+++ Zope/lib/python/OFS/XMLExportImport.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
import Shared.DC.xml.ppml
ppml=Shared.DC.xml.ppml
@@ -117,4 +117,3 @@
r=p.Parse(data)
outfile.seek(0)
return jar.importFile(outfile,clue)
-
=== Zope/lib/python/OFS/ZDOM.py 1.11 => 1.12 ===
--- Zope/lib/python/OFS/ZDOM.py:1.11 Thu Feb 7 12:20:59 2002
+++ Zope/lib/python/OFS/ZDOM.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""
DOM implementation in ZOPE : Read-Only methods
@@ -88,12 +88,12 @@
'getChildNodes', 'getFirstChild', 'getLastChild',
'getPreviousSibling', 'getNextSibling', 'getOwnerDocument',
'getAttributes', 'hasChildNodes'),
- ),
+ ),
)
- # DOM attributes
+ # DOM attributes
# --------------
-
+
def getNodeName(self):
"""The name of this node, depending on its type"""
return None
@@ -136,7 +136,7 @@
"""Returns a NamedNodeMap containing the attributes
of this node (if it is an element) or None otherwise."""
return None
-
+
def getOwnerDocument(self):
"""The Document object associated with this node.
When this is a document this is None"""
@@ -145,30 +145,30 @@
node = self.aq_parent
return node.getOwnerDocument()
return node
-
- # DOM Methods
+
+ # DOM Methods
# -----------
-
+
def hasChildNodes(self):
"""Returns true if the node has any children, false
if it doesn't. """
return len(self.objectIds())
-class Document(Acquisition.Explicit, Node):
+class Document(Acquisition.Explicit, Node):
"""
Document Interface
"""
-
+
__ac_permissions__=(
('Access contents information',
('getImplementation', 'getDoctype', 'getDocumentElement'),
- ),
+ ),
)
-
+
# Document Methods
# ----------------
-
+
def getImplementation(self):
"""
The DOMImplementation object that handles this document.
@@ -182,14 +182,14 @@
a document type declaration this returns null.
"""
return None
-
+
def getDocumentElement(self):
"""
This is a convenience attribute that allows direct access to
the child node that is the root element of the document.
"""
return self.aq_parent
-
+
# Node Methods
# ------------
@@ -199,13 +199,13 @@
def getNodeType(self):
"""A code representing the type of the node."""
- return DOCUMENT_NODE
+ return DOCUMENT_NODE
def getOwnerDocument(self):
"""The Document object associated with this node.
When this is a document this is None"""
return self
-
+
def getChildNodes(self):
"""Returns a NodeList that contains all children of this node.
If there are no children, this is a empty NodeList"""
@@ -225,7 +225,7 @@
"""Returns true if the node has any children, false
if it doesn't. """
return 1
-
+
class DOMImplementation:
"""
@@ -235,11 +235,11 @@
__ac_permissions__=(
('Access contents information',
('hasFeature'),
- ),
+ ),
)
-
+
def hasFeature(self, feature, version = None):
- """
+ """
hasFeature - Test if the DOM implementation implements a specific
feature. Parameters: feature The package name of the feature to
test. In Level 1, the legal values are "HTML" and "XML"
@@ -255,7 +255,7 @@
if version is None: return 1
if version == '1.0': return 1
return 0
-
+
class Element(Node):
"""
@@ -266,27 +266,27 @@
('Access contents information',
('getTagName', 'getAttribute', 'getAttributeNode',
'getElementsByTagName'),
- ),
+ ),
)
-
+
# Element Attributes
# ------------------
-
+
def getTagName(self):
"""The name of the element"""
return self.__class__.__name__
# Node Attributes
# ---------------
-
+
def getNodeName(self):
"""The name of this node, depending on its type"""
return self.getTagName()
-
+
def getNodeType(self):
"""A code representing the type of the node."""
return ELEMENT_NODE
-
+
def getParentNode(self):
"""The parent of this node. All nodes except Document
DocumentFragment and Attr may have a parent"""
@@ -296,7 +296,7 @@
"""Returns a NodeList that contains all children of this node.
If there are no children, this is a empty NodeList"""
return NodeList(self.objectValues())
-
+
def getFirstChild(self):
"""The first child of this node. If there is no such node
this returns None"""
@@ -340,10 +340,10 @@
if index >= len(ids)-1: return None
return parent.objectValues()[index+1]
return None
-
+
# Element Methods
# ---------------
-
+
def getAttribute(self, name):
"""Retrieves an attribute value by name."""
return None
@@ -369,15 +369,15 @@
n1 = child.getElementsByTagName(tagname)
nodeList = nodeList + n1._data
return NodeList(nodeList)
-
+
class ElementWithAttributes(Element):
"""
Elements that allow DOM access to Zope properties of type 'string'.
-
+
Note: This sub-class should only be used by PropertyManagers
"""
-
+
def getAttributes(self):
"""Returns a NamedNodeMap containing the attributes
of this node (if it is an element) or None otherwise."""
@@ -388,12 +388,12 @@
attrib=Attr(name, self.getProperty(name,'')).__of__(self)
attribs[name]=attrib
return NamedNodeMap(attribs)
-
+
def getAttribute(self, name):
"""Retrieves an attribute value by name."""
if self.getPropertyType(name) == 'string':
return self.getProperty(name,'')
-
+
def getAttributeNode(self, name):
"""Retrieves an Attr node by name or None if
there is no such attribute. """
@@ -405,10 +405,10 @@
class ElementWithTitle(Element):
"""
Elements that allow DOM access to Zope 'title' property.
-
+
Note: Don't use this sub-class for PropertyManagers
"""
-
+
def getAttributes(self):
"""Returns a NamedNodeMap containing the attributes
of this node (if it is an element) or None otherwise."""
@@ -416,13 +416,13 @@
if title is not None:
return NamedNodeMap({'title':title})
return NamedNodeMap()
-
+
def getAttribute(self, name):
"""Retrieves an attribute value by name."""
if name=='title' and hasattr(self.aq_base, 'title'):
return self.title
return ''
-
+
def getAttributeNode(self, name):
"""Retrieves an Attr node by name or None if
there is no such attribute. """
@@ -431,22 +431,22 @@
return Attr(name, value).__of__(self)
return None
-
+
class Root(ElementWithAttributes):
"""
The top-level Zope object.
"""
-
+
def getOwnerDocument(self):
"""
"""
return Document().__of__(self)
-
+
class NodeList:
"""NodeList interface - Provides the abstraction of an ordered
collection of nodes.
-
+
Python extensions: can use sequence-style 'len', 'getitem', and
'for..in' constructs.
"""
@@ -458,35 +458,35 @@
def __init__(self,list=None):
self._data = list or []
-
+
def __getitem__(self, index):
return self._data[index]
-
+
def item(self, index):
"""Returns the index-th item in the collection"""
- try: return self._data[index]
+ try: return self._data[index]
except IndexError: return None
-
+
def getLength(self):
"""The length of the NodeList"""
return len(self._data)
-
+
__len__=getLength
-
+
class NamedNodeMap:
"""
NamedNodeMap interface - Is used to represent collections
of nodes that can be accessed by name. NamedNodeMaps are not
maintained in any particular order.
-
+
Python extensions: can use sequence-style 'len', 'getitem', and
'for..in' constructs, and mapping-style 'getitem'.
"""
# Tell the security machinery to allow access to items.
__allow_access_to_unprotected_subobjects__=1
-
+
def __init__(self, data=None):
if data is None : data = {}
self._data = data
@@ -495,26 +495,26 @@
"""Returns the index-th item in the map"""
try: return self._data.values()[index]
except IndexError: return None
-
+
def __getitem__(self, key):
if type(key)==type(1):
return self._data.values()[key]
else:
return self._data[key]
-
+
def getLength(self):
"""The length of the NodeList"""
return len(self._data)
-
+
__len__ = getLength
-
+
def getNamedItem(self, name):
"""Retrieves a node specified by name. Parameters:
name Name of a node to retrieve. Return Value A Node (of any
type) with the specified name, or None if the specified name
did not identify any node in the map.
"""
- if self._data.has_key(name):
+ if self._data.has_key(name):
return self._data[name]
return None
@@ -529,7 +529,7 @@
self.name = name
self.value = value
self.specified = 1
-
+
def getNodeName(self):
"""The name of this node, depending on its type"""
return self.name
@@ -537,7 +537,7 @@
def getName(self):
"""Returns the name of this attribute."""
return self.name
-
+
def getNodeValue(self):
"""The value of this node, depending on its type"""
return self.value
@@ -550,5 +550,3 @@
"""If this attribute was explicitly given a value in the
original document, this is true; otherwise, it is false."""
return self.specified
-
-
=== Zope/lib/python/OFS/__init__.py 1.9 => 1.10 ===
--- Zope/lib/python/OFS/__init__.py:1.9 Wed Nov 28 10:50:57 2001
+++ Zope/lib/python/OFS/__init__.py Wed Aug 14 17:42:56 2002
@@ -1,12 +1,12 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
=== Zope/lib/python/OFS/content_types.py 1.17 => 1.18 ===
--- Zope/lib/python/OFS/content_types.py:1.17 Thu Feb 7 12:20:59 2002
+++ Zope/lib/python/OFS/content_types.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""A utility module for content-type handling."""
__version__='$Revision$'[11:-2]
@@ -86,15 +86,14 @@
if find_binary(body) is not None:
type=default or 'application/octet-stream'
else:
- type=(default or text_type(body)
+ type=(default or text_type(body)
or 'text/x-unknown-content-type')
else:
- type=default or 'text/x-unknown-content-type'
-
+ type=default or 'text/x-unknown-content-type'
+
return type.lower(), enc and enc.lower() or None
if __name__=='__main__':
items=mimetypes.types_map.items()
items.sort()
for item in items: print "%s:\t%s" % item
-
=== Zope/lib/python/OFS/misc_.py 1.20 => 1.21 ===
--- Zope/lib/python/OFS/misc_.py:1.20 Wed Nov 28 10:50:57 2001
+++ Zope/lib/python/OFS/misc_.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
from App.ImageFile import ImageFile
@@ -21,7 +21,7 @@
class p_:
"Shared system information"
__roles__=None
-
+
broken=ImageFile('www/broken.gif', globals())
User_icon =ImageFile('AccessControl/www/User_icon.gif')
=== Zope/lib/python/OFS/ndiff.py 1.3 => 1.4 ===
--- Zope/lib/python/OFS/ndiff.py:1.3 Mon Feb 25 10:32:32 2002
+++ Zope/lib/python/OFS/ndiff.py Wed Aug 14 17:42:56 2002
@@ -14,7 +14,7 @@
and intra-line differences are noted. In the second form, recreate file1
(-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.
-In the first form, if -q ("quiet") is not specified, the first two lines
+In the first form, if -q ("quiet") is not specified, the first two lines
of output are
-: file1
@@ -28,7 +28,7 @@
"? " line not present in either input file
Lines beginning with "? " attempt to guide the eye to intraline
-differences, and were not present in either input file. These lines can
+differences, and were not present in either input file. These lines can
be confusing if the source files contain tab characters.
The first file can be recovered by retaining only lines that begin with
=== Zope/lib/python/OFS/rPickle.py 1.5 => 1.6 ===
--- Zope/lib/python/OFS/rPickle.py:1.5 Wed Nov 28 10:50:57 2001
+++ Zope/lib/python/OFS/rPickle.py Wed Aug 14 17:42:56 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
-#
+#
##############################################################################
"""Restricted unpickler"""
@@ -42,5 +42,3 @@
def unregister(mod, cls):
"""Unregister a class"""
del reg[(mod,cls)]
-
-