[Zope-CVS] CVS: Products/AdaptableStorage - Zope2FS.py:1.21 Zope2Mapper.py:1.12 Zope2SQL.py:1.14
Shane Hathaway
shane@zope.com
Sat, 1 Mar 2003 15:43:30 -0500
Update of /cvs-repository/Products/AdaptableStorage
In directory cvs.zope.org:/tmp/cvs-serv29278
Modified Files:
Zope2FS.py Zope2Mapper.py Zope2SQL.py
Log Message:
- Added SecurityAttributes, FSSecurityAttributes, and
SQLSecurityAttributes. These classes store Zope 2 role names, local
roles, executable ownership, permission mappings, and proxy roles.
(Until now, all of this ended up in the remainder pickle.)
- Added a second abstract object mapper to Zope2Mapper. The "base"
mapper has no properties aspect, while the "base_p" mapper does. This
made Zope2FS and Zope2SQL a little cleaner, since they don't have to
remove the properties aspect.
- Added corresponding unit tests.
=== Products/AdaptableStorage/Zope2FS.py 1.20 => 1.21 ===
--- Products/AdaptableStorage/Zope2FS.py:1.20 Fri Feb 21 11:08:08 2003
+++ Products/AdaptableStorage/Zope2FS.py Sat Mar 1 15:42:58 2003
@@ -21,7 +21,7 @@
from mapper_std.public import PathKeychainGenerator
from gateway_fs.public import FSConnection, FSDirectoryItems, FSAutoId, \
FSSectionData, FSClassificationSection, FSFileData, FSProperties, \
- FSUserList
+ FSUserList, FSSecurityAttributes
from Zope2Mapper import createZope2Mapper
@@ -42,29 +42,34 @@
# abstract base gateway
g = ObjectGateway()
g.addGateway('id', FSAutoId())
- g.addGateway('properties', FSProperties(conn))
g.addGateway('remainder', FSSectionData(conn, 'remainder'))
+ g.addGateway('security', FSSecurityAttributes(conn))
root_mapper.getSubMapper('base').setGateway(g)
base = g
- # folder gateway
+ # abstract base gateway with properties
g = ObjectGateway(base)
+ g.addGateway('properties', FSProperties(conn))
+ root_mapper.getSubMapper('base_p').setGateway(g)
+ base_p = g
+
+ # folder gateway
+ g = ObjectGateway(base_p)
g.addGateway('items', FSDirectoryItems(conn))
root_mapper.getSubMapper('OFS.Folder.Folder').setGateway(g)
# page template gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.addGateway('text', file_data)
root_mapper.getSubMapper('ZopePageTemplate').setGateway(g)
# dtml method gateway
g = ObjectGateway(base)
g.addGateway('text', file_data)
- g.removeGateway('properties')
root_mapper.getSubMapper('OFS.DTMLMethod.DTMLMethod').setGateway(g)
# dtml document gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.addGateway('text', file_data)
root_mapper.getSubMapper('OFS.DTMLDocument.DTMLDocument').setGateway(g)
@@ -76,12 +81,11 @@
# python script mapper
g = ObjectGateway(base)
- g.removeGateway('properties')
g.addGateway('body', file_data)
root_mapper.getSubMapper('PythonScript').setGateway(g)
# file gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.addGateway('data', file_data)
root_mapper.getSubMapper('OFS.Image.File').setGateway(g)
@@ -90,22 +94,21 @@
# user folder gateway
g = ObjectGateway(base)
- g.removeGateway('properties')
g.addGateway('data', FSUserList(conn))
root_mapper.getSubMapper('AccessControl.User.UserFolder').setGateway(g)
# anyfolder object gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.addGateway('items', FSDirectoryItems(conn))
root_mapper.getSubMapper('anyfolder').setGateway(g)
# anyfile object gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.addGateway('remainder', file_data, 1)
root_mapper.getSubMapper('anyfile').setGateway(g)
# application gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.removeGateway('id')
g.addGateway('items', FSDirectoryItems(conn))
root_mapper.getSubMapper('OFS.Application.Application').setGateway(g)
=== Products/AdaptableStorage/Zope2Mapper.py 1.11 => 1.12 ===
--- Products/AdaptableStorage/Zope2Mapper.py:1.11 Fri Feb 21 11:08:08 2003
+++ Products/AdaptableStorage/Zope2Mapper.py Sat Mar 1 15:42:58 2003
@@ -26,7 +26,7 @@
import FolderItems, FolderItemsByKeychain, MetaTypeClassifier, \
IdAttribute, FilePData, OFSProperties, UserFolderSerializer, \
PythonScriptSerializer, ZSQLMethodSerializer, \
- ZSQLMethodPropertiesSerializer
+ ZSQLMethodPropertiesSerializer, SecurityAttributes
from zodb.public import RemainingState
@@ -56,20 +56,27 @@
s = ObjectSerializer(None, None)
m.setSerializer(s)
s.addAspect('id', IdAttribute())
- s.addAspect('properties', OFSProperties())
+ s.addAspect('security', SecurityAttributes())
s.addAspect('remainder', RemainingState(), final=1)
base = s
+ # abstract mapper with properties
+ m = root_mapper.addSubMapper('base_p')
+ s = ObjectSerializer(None, None, base)
+ m.setSerializer(s)
+ s.addAspect('properties', OFSProperties())
+ base_p = s
+
# folder mapper
m = root_mapper.addSubMapper('OFS.Folder.Folder')
- s = ObjectSerializer('OFS.Folder', 'Folder', base)
+ s = ObjectSerializer('OFS.Folder', 'Folder', base_p)
m.setSerializer(s)
s.addAspect('items', folder_items_aspect)
classifier.registerDefaultLoader('Folder', 'OFS.Folder.Folder', 1)
# file mapper
m = root_mapper.addSubMapper('OFS.Image.File')
- s = ObjectSerializer('OFS.Image', 'File', base)
+ s = ObjectSerializer('OFS.Image', 'File', base_p)
m.setSerializer(s)
s.addAspect('data', FilePData())
classifier.registerDefaultLoader('File', 'OFS.Image.File', 0)
@@ -77,7 +84,7 @@
# image mapper
m = root_mapper.addSubMapper('OFS.Image.Image')
- s = ObjectSerializer('OFS.Image', 'Image', base)
+ s = ObjectSerializer('OFS.Image', 'Image', base_p)
m.setSerializer(s)
s.addAspect('data', FilePData())
classifier.register('Image', 'OFS.Image.Image', (
@@ -87,7 +94,7 @@
# page template mapper
m = root_mapper.addSubMapper('ZopePageTemplate') # abbreviated name
s = ObjectSerializer('Products.PageTemplates.ZopePageTemplate',
- 'ZopePageTemplate', base)
+ 'ZopePageTemplate', base_p)
m.setSerializer(s)
s.addAspect('text', StringDataAttribute('_text'))
classifier.register('Page Template', 'ZopePageTemplate', (
@@ -98,12 +105,11 @@
s = ObjectSerializer('OFS.DTMLMethod', 'DTMLMethod', base)
m.setSerializer(s)
s.addAspect('text', StringDataAttribute('raw'))
- s.removeAspect('properties')
classifier.register('DTML Method', 'OFS.DTMLMethod.DTMLMethod', ('.dtml',))
# dtml document mapper
m = root_mapper.addSubMapper('OFS.DTMLDocument.DTMLDocument')
- s = ObjectSerializer('OFS.DTMLDocument', 'DTMLDocument', base)
+ s = ObjectSerializer('OFS.DTMLDocument', 'DTMLDocument', base_p)
m.setSerializer(s)
s.addAspect('text', StringDataAttribute('raw'))
classifier.register('DTML Document', 'OFS.DTMLDocument.DTMLDocument')
@@ -123,7 +129,6 @@
'PythonScript', base)
m.setSerializer(s)
s.addAspect('body', PythonScriptSerializer())
- s.removeAspect('properties')
classifier.register('Script (Python)', 'PythonScript', ('.py', ))
# user folder mapper
@@ -131,7 +136,6 @@
s = ObjectSerializer('AccessControl.User', 'UserFolder', base)
m.setSerializer(s)
s.addAspect('data', UserFolderSerializer())
- s.removeAspect('properties')
classifier.register('User Folder', 'AccessControl.User.UserFolder')
# anyfolder mapper
@@ -151,7 +155,7 @@
# application mapper
m = root_mapper.addSubMapper('OFS.Application.Application')
- s = ObjectSerializer('OFS.Application', 'Application', base)
+ s = ObjectSerializer('OFS.Application', 'Application', base_p)
m.setSerializer(s)
s.removeAspect('id')
s.addAspect('items', folder_items_aspect)
=== Products/AdaptableStorage/Zope2SQL.py 1.13 => 1.14 ===
--- Products/AdaptableStorage/Zope2SQL.py:1.13 Fri Feb 21 11:08:08 2003
+++ Products/AdaptableStorage/Zope2SQL.py Sat Mar 1 15:42:58 2003
@@ -20,7 +20,7 @@
from mapper.public import ObjectGateway
from gateway_sql.public import SQLClassification, \
SQLFolderItems, SQLItemId, SQLKeychainGenerator, SQLObjectData, \
- SQLProperties, SQLRemainder, SQLUserList
+ SQLProperties, SQLRemainder, SQLUserList, SQLSecurityAttributes
from Zope2Mapper import createZope2Mapper
@@ -37,6 +37,7 @@
remainder_gw = SQLRemainder(conn)
file_data_gw = SQLObjectData(conn)
properties_gw = SQLProperties(conn)
+ security_gw = SQLSecurityAttributes(conn)
classification_gw = SQLClassification(conn)
keychain_gen = SQLKeychainGenerator(conn)
gws = (
@@ -52,45 +53,49 @@
# abstract base gateway
g = ObjectGateway()
g.addGateway('id', item_id_gw)
- g.addGateway('properties', properties_gw)
g.addGateway('remainder', remainder_gw)
+ g.addGateway('security', security_gw)
root_mapper.getSubMapper('base').setGateway(g)
base = g
- # folder gateway
+ # abstract base gateway with properties
g = ObjectGateway(base)
+ g.addGateway('properties', properties_gw)
+ root_mapper.getSubMapper('base_p').setGateway(g)
+ base_p = g
+
+ # folder gateway
+ g = ObjectGateway(base_p)
g.addGateway('items', folder_items_gw)
root_mapper.getSubMapper('OFS.Folder.Folder').setGateway(g)
# page template gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.addGateway('text', file_data_gw)
root_mapper.getSubMapper('ZopePageTemplate').setGateway(g)
# dtml method gateway
g = ObjectGateway(base)
g.addGateway('text', file_data_gw)
- g.removeGateway('properties')
root_mapper.getSubMapper('OFS.DTMLMethod.DTMLMethod').setGateway(g)
# dtml document gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.addGateway('text', file_data_gw)
root_mapper.getSubMapper('OFS.DTMLDocument.DTMLDocument').setGateway(g)
# zsqlmethod mapper
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.addGateway('text', file_data_gw)
root_mapper.getSubMapper('Products.ZSQLMethods.SQL.SQL').setGateway(g)
# python script mapper
g = ObjectGateway(base)
g.addGateway('body', file_data_gw)
- g.removeGateway('properties')
root_mapper.getSubMapper('PythonScript').setGateway(g)
# file gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.addGateway('data', file_data_gw)
root_mapper.getSubMapper('OFS.Image.File').setGateway(g)
@@ -100,20 +105,19 @@
# user folder gateway
g = ObjectGateway(base)
g.addGateway('data', SQLUserList(conn))
- g.removeGateway('properties')
root_mapper.getSubMapper('AccessControl.User.UserFolder').setGateway(g)
# anyfolder object gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.addGateway('items', folder_items_gw)
root_mapper.getSubMapper('anyfolder').setGateway(g)
# anyfile object gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
root_mapper.getSubMapper('anyfile').setGateway(g)
# application gateway
- g = ObjectGateway(base)
+ g = ObjectGateway(base_p)
g.removeGateway('id')
g.addGateway('items', folder_items_gw)
root_mapper.getSubMapper('OFS.Application.Application').setGateway(g)