[Zope-Checkins] CVS: Zope/lib/python/ZClasses - Basic.py:1.21 Method.py:1.23 ObjectManager.py:1.9 Property.py:1.35 ZClass.py:1.63 ZClassOwner.py:1.10 __init__.py:1.7
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 18:03:40 -0400
Update of /cvs-repository/Zope/lib/python/ZClasses
In directory cvs.zope.org:/tmp/cvs-serv19457
Modified Files:
Basic.py Method.py ObjectManager.py Property.py ZClass.py
ZClassOwner.py __init__.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/ZClasses/Basic.py 1.20 => 1.21 ===
--- Zope/lib/python/ZClasses/Basic.py:1.20 Thu Feb 7 13:10:58 2002
+++ Zope/lib/python/ZClasses/Basic.py Wed Aug 14 18:03:39 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
-#
+#
##############################################################################
"""Basic Item class and class manager
"""
@@ -40,11 +40,11 @@
OFS.Image.Image('ziconImage','',file))
else:
image.manage_upload(file)
-
+
if (not icon) and REQUEST:
icon=(REQUEST['URL3'][len(REQUEST['BASE1'])+1:]
+'/ziconImage')
-
+
self.setClassAttr('icon', icon)
if title is not None:
@@ -60,7 +60,7 @@
def classMetaType(self): return self.getClassAttr('meta_type','')
-
+
def classIcon(self): return self.getClassAttr('icon','')
def show_class_id(self): return Globals.DatabaseVersion=='3'
@@ -102,7 +102,7 @@
message='The changes were saved.'
else:
message='No changes were required.'
-
+
if REQUEST is not None:
return self.manage(
self, REQUEST, manage_tabs_message=message)
@@ -119,7 +119,7 @@
message='Views deleted'
else:
message='No views were selected for deletion'
-
+
if REQUEST is not None:
return self.manage(
self, REQUEST, manage_tabs_message=message)
@@ -149,7 +149,7 @@
else:
t=({'label': label, 'action': action},)
self.setClassAttr('manage_options', tuple(options) + t)
-
+
if REQUEST is not None:
return self.manage(
self, REQUEST,
@@ -178,13 +178,13 @@
if REQUEST is not None:
return self.manage(
- self, REQUEST, manage_tabs_message=message)
-
+ self, REQUEST, manage_tabs_message=message)
+
class ZClassPermissionsSheet(OFS.PropertySheets.PropertySheet,
OFS.PropertySheets.View):
"Manage class permissions"
-
+
manage=Globals.DTMLFile('dtml/classPermissions', globals())
def possible_permissions(self):
@@ -204,11 +204,9 @@
self.aq_acquire('_getProductRegistryData')('ac_permissions')):
if p[0] in selected:
r.append(p)
-
+
self.setClassAttr('__ac_permissions__', tuple(r))
if REQUEST is not None:
return self.manage(self, REQUEST,
manage_tabs_message="Permissions updated")
-
-
=== Zope/lib/python/ZClasses/Method.py 1.22 => 1.23 ===
--- Zope/lib/python/ZClasses/Method.py:1.22 Thu Feb 7 13:10:58 2002
+++ Zope/lib/python/ZClasses/Method.py Wed Aug 14 18:03:39 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
-#
+#
##############################################################################
"""Basic Item class and class manager
"""
@@ -42,7 +42,7 @@
# Hijinks to let us create factories and classes within classes.
#meta_types=App.Product.Product.meta_types
-
+
meta_types=(
{'name': 'Z Class',
'action':'manage_addZClassForm'},
@@ -53,7 +53,7 @@
'action': 'manage_addPropertyInterfaceForm'
},
)
-
+
def manage_addPrincipiaFactory(
self, id, title, object_type, initial, permission=None, REQUEST=None):
' '
@@ -67,7 +67,7 @@
def _getProductRegistryMetaTypes(self):
return self.getClassAttr('_zclass_method_meta_types',())
-
+
def _setProductRegistryMetaTypes(self, v):
return self.setClassAttr('_zclass_method_meta_types', v)
@@ -166,9 +166,9 @@
if hasattr(self, 'aq_base'):
b=self.aq_base
if hasattr(b,name): return getattr(self, name)
-
+
try: return self[name]
- except: return getattr(self, name)
+ except: return getattr(self, name)
def possible_permissions(self):
return self.classDefinedAndInheritedPermissions()
@@ -213,7 +213,7 @@
class MW(ExtensionClass.Base):
def __init__(self, meth): self.__dict__[methodattr]=meth
-
+
def __of__(self, parent):
m=getattr(self, methodattr)
m=self.__dict__[methodattr]
@@ -230,7 +230,7 @@
def __getstate__(self):
getattr(self, methodattr)
return self.__dict__[methodattr]
-
+
def __of__(self, parent):
m=getattr(self, methodattr)
m=self.__dict__[methodattr]
@@ -239,13 +239,13 @@
if hasattr(m,'__of__'): return aqwrap(m, wrapper, parent)
return m
-
+
# Backward compat. Waaaaa
class W(Globals.Persistent, MW):
_View_Permission='_View_Permission'
-
+
def __getattr__(self, name):
# We want to make sure that any non-explicitly set methods are
# private!
@@ -253,16 +253,16 @@
# Oh this sucks
return W.inheritedAttribute('__getattr__')(self, name)
except: pass
-
+
if name[:1]=='_' and name[-11:]=="_Permission": return ''
raise AttributeError, name
-
+
def __of__(self, parent):
m=getattr(self, methodattr)
m=self.__dict__[methodattr]
if hasattr(m,'__of__'): return aqwrap(m, self, parent)
return m
-
+
def findMethodIds(klass, methodTypes=(MWp, MW, W)):
r=[]
=== Zope/lib/python/ZClasses/ObjectManager.py 1.8 => 1.9 ===
--- Zope/lib/python/ZClasses/ObjectManager.py:1.8 Wed Nov 28 10:51:18 2001
+++ Zope/lib/python/ZClasses/ObjectManager.py Wed Aug 14 18:03:39 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-manager mix-in for ZClasses
"""
@@ -20,7 +20,7 @@
"""Provide management view for selecting sub-objects.
"""
manage=Globals.DTMLFile('dtml/subobjects', globals())
-
+
def possible_meta_types(self):
return self.aq_acquire('_product_meta_types')+Products.meta_types
=== Zope/lib/python/ZClasses/Property.py 1.34 => 1.35 ===
--- Zope/lib/python/ZClasses/Property.py:1.34 Thu Feb 7 13:10:58 2002
+++ Zope/lib/python/ZClasses/Property.py Wed Aug 14 18:03:39 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
-#
+#
##############################################################################
"""Provide management of common instance property sheets
"""
@@ -25,13 +25,13 @@
setattr(klass, name, v)
if not getattr(klass,'_p_changed',None):
get_transaction().register(klass)
- klass._p_changed=1
+ klass._p_changed=1
def __delattr__(self, name):
klass=self._k
delattr(klass, name)
if not getattr(klass,'_p_changed',None):
get_transaction().register(klass)
- klass._p_changed=1
+ klass._p_changed=1
class ZCommonSheet(OFS.PropertySheets.PropertySheet, OFS.SimpleItem.Item):
@@ -49,7 +49,7 @@
__ac_permissions__=(
('Manage Z Classes', ('', 'manage')),
)
-
+
def __init__(self, id, title):
self.id=id
self.title=title
@@ -82,7 +82,7 @@
"""
if ps_view_type == 'Edit':
return self.manage_createEditor(id, title, REQUEST)
-
+
r=['<dtml-var standard_html_header>',
'<table>']
a=r.append
@@ -116,29 +116,29 @@
<dtml-if %s>CHECKED</dtml-if>>'''
% (id, id)
)
-
+
if t=='tokens':
return ('''
<input type="text" name="%s:tokens" size="35"
value="<dtml-in %s><dtml-var sequence-item> </dtml-in>">'''
% (id, id)
)
-
+
if t=='text':
return ('''
<textarea name="%s:text" rows="6" cols="35"><dtml-var %s
></textarea>'''
% (id, id)
)
-
+
if t=='lines':
return ('''
<textarea name="%s:lines" rows="6" cols="35"><dtml-in %s
><dtml-var sequence-item>\n</dtml-in></textarea>'''
- % (id, id)
+ % (id, id)
)
-
+
if t=='selection':
return ('''
<dtml-if "_.has_key('%(id)s')">
@@ -152,7 +152,7 @@
</select>
<dtml-else>
No value for %(id)s
- </dtml-if>'''
+ </dtml-if>'''
% p
)
@@ -196,7 +196,7 @@
def manage_getPermissionMapping(self):
ips=self.getClassAttr('propertysheets')
ips=getattr(ips, self.id)
-
+
# ugh
perms={}
for p in self.classDefinedAndInheritedPermissions():
@@ -211,7 +211,7 @@
})
return r
-
+
def manage_setPermissionMapping(self, permission_names=[],
class_permissions=[],
REQUEST=None):
@@ -233,7 +233,7 @@
if REQUEST is not None:
return self.manage_security(
- self, REQUEST,
+ self, REQUEST,
manage_tabs_message='The permission mapping has been updated')
Globals.default__class_init__(ZCommonSheet)
@@ -263,12 +263,12 @@
'propertyMap', ''),
),
)
-
+
def v_self(self):
return self.aq_inner.aq_parent.aq_parent
Globals.default__class_init__(ZInstanceSheet)
-
+
def rclass(klass):
if not getattr(klass, '_p_changed', 0):
get_transaction().register(klass)
@@ -294,7 +294,7 @@
setattr(pc,id,ZInstanceSheet(id,value))
pc.__propset_attrs__=tuple(map(lambda o: o['id'], self._objects))
rclass(pc)
-
+
def _delOb(self, id):
delattr(self, id)
@@ -336,7 +336,7 @@
class ZInstanceSheets(OFS.PropertySheets.PropertySheets, Globals.Persistent):
" "
- __propset_attrs__=()
+ __propset_attrs__=()
_implements_the_notional_subclassable_propertysheet_class_interface=1
def __propsets__(self):
@@ -346,5 +346,5 @@
r.append(getattr(self, id))
return propsets+tuple(r)
-
+
Globals.default__class_init__(ZInstanceSheets)
=== Zope/lib/python/ZClasses/ZClass.py 1.62 => 1.63 ===
--- Zope/lib/python/ZClasses/ZClass.py:1.62 Fri Apr 26 13:38:34 2002
+++ Zope/lib/python/ZClasses/ZClass.py Wed Aug 14 18:03:39 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
-#
+#
##############################################################################
"""Zope Classes
"""
@@ -70,14 +70,14 @@
base_module = base_class.__module__
base_name = base_class.__name__
-
+
key = "%s/%s" % (base_module, base_name)
if base_module[:9] == 'Products.':
base_module = base_module.split('.' )[1]
else:
base_module = base_module.split('.' )[0]
-
+
info="%s: %s" % ( base_module, base_name )
Products.meta_class_info[key] = info # meta_type
@@ -150,8 +150,8 @@
if CreateAFactory and meta_type:
self.manage_addDTMLMethod(
- id+'_addForm',
- id+' constructor input form',
+ id+'_addForm',
+ id+' constructor input form',
addFormDefault % {'id': id, 'meta_type': meta_type},
)
constScript = PythonScript(id+'_add')
@@ -160,14 +160,14 @@
self.manage_addPermission(
id+'_add_permission',
id+' constructor permission',
- 'Add %ss' % meta_type
+ 'Add %ss' % meta_type
)
self.manage_addPrincipiaFactory(
id+'_factory',
id+' factory',
meta_type,
id+'_addForm',
- 'Add %ss' % meta_type
+ 'Add %ss' % meta_type
)
Z=self._getOb(id)
@@ -176,7 +176,7 @@
Z.manage_setPermissionMapping(
permission_names=['Create class instances'],
class_permissions=['Add %ss' % meta_type]
- )
+ )
if REQUEST is not None:
return self.manage_main(self,REQUEST, update_menu=1)
@@ -187,13 +187,13 @@
def PersistentClassDict(doc=None, meta_type=None):
# Build new class dict
- dict={}
- dict.update(Template.__dict__)
- if meta_type is not None:
- dict['meta_type']=dict['__doc__']=meta_type
- if doc is not None:
- dict['__doc__']=doc
- return dict
+ dict={}
+ dict.update(Template.__dict__)
+ if meta_type is not None:
+ dict['meta_type']=dict['__doc__']=meta_type
+ if doc is not None:
+ dict['__doc__']=doc
+ return dict
_marker=[]
class ZClass( Base
@@ -208,7 +208,7 @@
instance__icon=''
__propsets__=()
isPrincipiaFolderish=1
-
+
__ac_permissions__=(
('Create class instances',
('', '__call__', 'index_html', 'createInObjectManager')),
@@ -222,7 +222,7 @@
"""
self.id=id
self.title=title
-
+
# Set up base classes for new class, the meta class prop
# sheet and the class(/instance) prop sheet.
base_classes=[PersistentClass]
@@ -246,7 +246,7 @@
if zope_object:
base_classes.append(OFS.SimpleItem.SimpleItem)
-
+
zsheets_base_classes.append(ZClassSheets)
isheets_base_classes.append(Property.ZInstanceSheets)
@@ -272,17 +272,17 @@
copy.update(option)
options.append(copy)
c.manage_options=tuple(options)
-
+
# Create the class(/instance) prop sheet *class*
isheets_class=type(PersistentClass)(
id+'_PropertySheetsClass',
tuple(isheets_base_classes),
- PersistentClassDict(id+' Property Sheets'))
+ PersistentClassDict(id+' Property Sheets'))
# Record the class property sheet class in the meta-class so
# that we can manage it:
self._zclass_propertysheets_class=isheets_class
-
+
# Finally create the new classes propertysheets by instantiating the
# propertysheets class.
c.propertysheets=isheets_class()
@@ -410,7 +410,7 @@
def manage_afterClone(self, item):
self.setClassAttr('__module__', None)
self.propertysheets.methods.manage_afterClone(item)
-
+
def manage_afterAdd(self, item, container):
if not dbVersionEquals('3'):
return
@@ -430,7 +430,7 @@
d={}
have=d.has_key
for z in self._zbases:
- for o in z.manage_options:
+ for o in z.manage_options:
label=o['label']
if have(label): continue
d[label]=1
@@ -469,7 +469,7 @@
# An object is not guarenteed to have the id we passed in.
id = i.getId()
return folder._getOb(id)
-
+
index_html=createInObjectManager
def fromRequest(self, id=None, REQUEST={}):
@@ -477,7 +477,7 @@
if id is not None and (not hasattr(i, 'id') or not i.id): i.id=id
return i
-
+
def __call__(self, *args, **kw):
return apply(self._zclass_, args, kw)
@@ -578,7 +578,7 @@
files=self.__dict__.items()
if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and
self.isTopLevelPrincipiaApplicationObject):
- files.insert(0,('..',self.aq_parent))
+ files.insert(0,('..',self.aq_parent))
for k,v in files:
try: stat=marshal.loads(v.manage_FTPstat(REQUEST))
except:
@@ -609,7 +609,7 @@
if not self.propertysheets.meta_type in filter:
values.remove( value )
return values
-
+
class ZClassSheets(OFS.PropertySheets.PropertySheets):
"Manage a collection of property sheets that provide ZClass management"
@@ -637,7 +637,7 @@
files=self.__dict__.items()
if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and
self.isTopLevelPrincipiaApplicationObject):
- files.insert(0,('..',self.aq_parent))
+ files.insert(0,('..',self.aq_parent))
for k,v in files:
try: stat=marshal.loads(v.manage_FTPstat(REQUEST))
except:
@@ -666,21 +666,21 @@
manage_options=(
{'label': 'Methods', 'action' :'propertysheets/methods/manage',
- 'help':('OFSP','ZClass_Methods.stx')},
+ 'help':('OFSP','ZClass_Methods.stx')},
{'label': 'Basic', 'action' :'propertysheets/basic/manage',
- 'help':('OFSP','ZClass_Basic.stx')},
+ 'help':('OFSP','ZClass_Basic.stx')},
{'label': 'Views', 'action' :'propertysheets/views/manage',
- 'help':('OFSP','ZClass_Views.stx')},
+ 'help':('OFSP','ZClass_Views.stx')},
{'label': 'Property Sheets', 'action' :'propertysheets/common/manage',
- 'help':('OFSP','ZClass_Property-Sheets.stx')},
+ 'help':('OFSP','ZClass_Property-Sheets.stx')},
{'label': 'Permissions',
'action' :'propertysheets/permissions/manage',
- 'help':('OFSP','ZClass_Permissions.stx')},
- {'label': 'Define Permissions', 'action' :'manage_access',
- 'help':('OFSP','Security_Define-Permissions.stx')},
+ 'help':('OFSP','ZClass_Permissions.stx')},
+ {'label': 'Define Permissions', 'action' :'manage_access',
+ 'help':('OFSP','Security_Define-Permissions.stx')},
)
-
+
ZStandardSheets=ZObject
def findActions(klass, found):
@@ -691,17 +691,17 @@
findActions(b, found)
except: pass
-addFormDefault="""<HTML>
-<HEAD><TITLE>Add %(meta_type)s</TITLE></HEAD>
-<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
-<H2>Add %(meta_type)s</H2>
-<form action="%(id)s_add"><table>
-<tr><th>Id</th>
- <td><input type=text name=id></td>
-</tr>
-<tr><td></td><td><input type=submit value=" Add "></td></tr>
-</table></form>
-</body></html>
+addFormDefault="""<HTML>
+<HEAD><TITLE>Add %(meta_type)s</TITLE></HEAD>
+<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
+<H2>Add %(meta_type)s</H2>
+<form action="%(id)s_add"><table>
+<tr><th>Id</th>
+ <td><input type=text name=id></td>
+</tr>
+<tr><td></td><td><input type=submit value=" Add "></td></tr>
+</table></form>
+</body></html>
"""
addDefault="""## Script (Python) "%(id)s_add"
=== Zope/lib/python/ZClasses/ZClassOwner.py 1.9 => 1.10 ===
--- Zope/lib/python/ZClasses/ZClassOwner.py:1.9 Wed Nov 28 10:51:18 2001
+++ Zope/lib/python/ZClasses/ZClassOwner.py Wed Aug 14 18:03:39 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
-#
+#
##############################################################################
"""Zope Classes
"""
@@ -20,7 +20,7 @@
for data in self.aq_acquire('_getProductRegistryData')('zclasses'):
r['%(product)s/%(id)s' % data] = '%(product)s: %(id)s' % data
-
+
r=r.items()
r.sort()
return r
=== Zope/lib/python/ZClasses/__init__.py 1.6 => 1.7 ===
--- Zope/lib/python/ZClasses/__init__.py:1.6 Wed Nov 1 17:59:34 2000
+++ Zope/lib/python/ZClasses/__init__.py Wed Aug 14 18:03:39 2002
@@ -1,16 +1,16 @@
-##############################################################################
+##############################################################################
#
-# Copyright
+# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved.
#
-##############################################################################
+##############################################################################
__doc__='''Sample product initialization module
The job of this module is to provide any run-time initialization
-needed by a product and to define product meta data.
+needed by a product and to define product meta data.
This sample product publishes a folder-ish and a simple object.
@@ -34,7 +34,7 @@
'manage_addZClassForm': ZClass.manage_addZClassForm,
'manage_addZClass': ZClass.manage_addZClass,
'manage_subclassableClassNames': ZClassOwner.manage_subclassableClassNames,
-
+
}
# Permission to be added to folders: