[Zope-CVS] CVS: Products/AdaptableStorage - CHANGES.txt:1.5 Zope2FS.py:1.18 Zope2Mapper.py:1.6 Zope2SQL.py:1.11

Shane Hathaway shane@zope.com
Mon, 3 Feb 2003 13:27:20 -0500


Update of /cvs-repository/Products/AdaptableStorage
In directory cvs.zope.org:/tmp/cvs-serv10265

Modified Files:
	CHANGES.txt Zope2FS.py Zope2Mapper.py Zope2SQL.py 
Log Message:
Integrated work by Christian Zagrodnick: added mappers for Python Scripts,
DTML Methods, DTML Documents, and ZSQLMethods.  Thanks!


=== Products/AdaptableStorage/CHANGES.txt 1.4 => 1.5 ===
--- Products/AdaptableStorage/CHANGES.txt:1.4	Tue Jan 21 11:49:41 2003
+++ Products/AdaptableStorage/CHANGES.txt	Mon Feb  3 13:26:47 2003
@@ -1,8 +1,11 @@
 
-Next bugfix release
+Next release
 
   - Fixed storage of selection properties.  The select_variable was
     being forgotten.
+
+  - Integrated work by Christian Zagrodnick: added mappers for Python
+    Scripts, DTML Methods, DTML Documents, and ZSQLMethods.  Thanks!
 
 Version 0.4.2
 


=== Products/AdaptableStorage/Zope2FS.py 1.17 => 1.18 ===
--- Products/AdaptableStorage/Zope2FS.py:1.17	Mon Jan  6 18:17:39 2003
+++ Products/AdaptableStorage/Zope2FS.py	Mon Feb  3 13:26:47 2003
@@ -38,30 +38,62 @@
     root_mapper.getClassifier().setGateway(FSClassificationSection(conn))
     root_mapper.setKeychainGenerator(PathKeychainGenerator())
 
+    item_id_gw = FSAutoId()
     properties_gw = FSProperties(conn)
+    remainder_gw = FSSectionData(conn, 'remainder')
 
     # folder gateway
     g = ObjectGateway()
     g.addGateway('items', FSDirectoryItems(conn))
     g.addGateway('properties', properties_gw)
-    g.addGateway('id', FSAutoId())
-    g.addGateway('remainder', FSSectionData(conn, 'remainder'))
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
     root_mapper.getSubMapper('OFS.Folder.Folder').setGateway(g)
 
     # page template gateway
     g = ObjectGateway()
     g.addGateway('text', FSFileData(conn))
     g.addGateway('properties', properties_gw)
-    g.addGateway('id', FSAutoId())
-    g.addGateway('remainder', FSSectionData(conn, 'remainder'))
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
     root_mapper.getSubMapper('ZopePageTemplate').setGateway(g)
 
+    # dtml method gateway
+    g = ObjectGateway()
+    g.addGateway('text', FSFileData(conn))
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
+    root_mapper.getSubMapper('OFS.DTMLMethod.DTMLMethod').setGateway(g)
+    
+    # dtml document gateway
+    g = ObjectGateway()
+    g.addGateway('text', FSFileData(conn))
+    g.addGateway('properties', properties_gw)
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
+    root_mapper.getSubMapper('OFS.DTMLDocument.DTMLDocument').setGateway(g)
+
+    # zsqlmethod mapper
+    g = ObjectGateway()
+    g.addGateway('text', FSFileData(conn))
+    g.addGateway('properties', FSProperties(conn, 'ZSQL Properties'))
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
+    root_mapper.getSubMapper('Products.ZSQLMethods.SQL.SQL').setGateway(g)
+
+    # python script mapper
+    g = ObjectGateway()
+    g.addGateway('body', FSFileData(conn))
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
+    root_mapper.getSubMapper('PythonScript').setGateway(g)
+
     # file gateway
     g = ObjectGateway()
     g.addGateway('data', FSFileData(conn))
     g.addGateway('properties', properties_gw)
-    g.addGateway('id', FSAutoId())
-    g.addGateway('remainder', FSSectionData(conn, 'remainder'))
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
     root_mapper.getSubMapper('OFS.Image.File').setGateway(g)
 
     # image gateway is identical
@@ -70,21 +102,21 @@
     # user folder gateway
     g = ObjectGateway()
     g.addGateway('data', FSUserList(conn))
-    g.addGateway('id', FSAutoId())
-    g.addGateway('remainder', FSSectionData(conn, 'remainder'))
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
     root_mapper.getSubMapper('AccessControl.User.UserFolder').setGateway(g)
 
     # anyfolder object gateway
     g = ObjectGateway()
     g.addGateway('items', FSDirectoryItems(conn))
     g.addGateway('properties', properties_gw)
-    g.addGateway('id', FSAutoId())
-    g.addGateway('remainder', FSSectionData(conn, 'remainder'))
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
     root_mapper.getSubMapper('anyfolder').setGateway(g)
 
     # anyfile object gateway
     g = ObjectGateway()
-    g.addGateway('id', FSAutoId())
+    g.addGateway('id', item_id_gw)
     g.addGateway('remainder', FSFileData(conn))
     root_mapper.getSubMapper('anyfile').setGateway(g)
 
@@ -92,7 +124,7 @@
     g = ObjectGateway()
     g.addGateway('properties', properties_gw)
     g.addGateway('items', FSDirectoryItems(conn))
-    g.addGateway('remainder', FSSectionData(conn, 'remainder'))
+    g.addGateway('remainder', remainder_gw)
     root_mapper.getSubMapper('OFS.Application.Application').setGateway(g)
 
     root_mapper.checkConfiguration()


=== Products/AdaptableStorage/Zope2Mapper.py 1.5 => 1.6 ===
--- Products/AdaptableStorage/Zope2Mapper.py:1.5	Mon Jan  6 18:17:39 2003
+++ Products/AdaptableStorage/Zope2Mapper.py	Mon Feb  3 13:26:47 2003
@@ -24,7 +24,9 @@
      AnyObjectSerializer, StringDataAttribute, OptionalAspect
 from serial_ofs.public \
      import FolderItems, FolderItemsByKeychain, MetaTypeClassifier, \
-     IdAttribute, FilePData, OFSProperties, UserFolderSerializer
+     IdAttribute, FilePData, OFSProperties, UserFolderSerializer, \
+     PythonScriptSerializer, ZSQLMethodSerializer, \
+     ZSQLMethodPropertiesSerializer
 from zodb.public import RemainingState
 
 
@@ -49,6 +51,8 @@
     else:
         folder_items_aspect = FolderItems()
     properties_aspect = OFSProperties()
+    id_aspect = IdAttribute()
+    remainder_aspect = RemainingState()
 
     # folder mapper
     m = root_mapper.addSubMapper('OFS.Folder.Folder')
@@ -56,28 +60,28 @@
     m.setSerializer(s)
     s.addAspect('items', folder_items_aspect)
     s.addAspect('properties', properties_aspect)
-    s.addAspect('id', IdAttribute())
-    s.addAspect('remainder', RemainingState())
+    s.addAspect('id', id_aspect)
+    s.addAspect('remainder', remainder_aspect)
     classifier.registerDefaultLoader('Folder', 'OFS.Folder.Folder', 1)
 
     # file mapper
     m = root_mapper.addSubMapper('OFS.Image.File')
     s = ObjectSerializer('OFS.Image', 'File')
     m.setSerializer(s)
-    s.addAspect('id', IdAttribute())
+    s.addAspect('id', id_aspect)
     s.addAspect('properties', properties_aspect)
     s.addAspect('data', FilePData())
-    s.addAspect('remainder', RemainingState())
+    s.addAspect('remainder', remainder_aspect)
     classifier.registerDefaultLoader('File', 'OFS.Image.File', 0)
 
     # image mapper
     m = root_mapper.addSubMapper('OFS.Image.Image')
     s = ObjectSerializer('OFS.Image', 'Image')
     m.setSerializer(s)
-    s.addAspect('id', IdAttribute())
+    s.addAspect('id', id_aspect)
     s.addAspect('properties', properties_aspect)
     s.addAspect('data', FilePData())
-    s.addAspect('remainder', RemainingState())
+    s.addAspect('remainder', remainder_aspect)
     classifier.register('Image', 'OFS.Image.Image', (
         '.gif', '.jpg', '.jpeg', '.png'))
 
@@ -88,18 +92,58 @@
     m.setSerializer(s)
     s.addAspect('text', StringDataAttribute('_text'))
     s.addAspect('properties', properties_aspect)
-    s.addAspect('id', IdAttribute())
-    s.addAspect('remainder', RemainingState())
+    s.addAspect('id', id_aspect)
+    s.addAspect('remainder', remainder_aspect)
     classifier.register('Page Template', 'ZopePageTemplate', (
         '.pt', '.zpt', '.html'))
 
+    # dtml method mapper
+    m = root_mapper.addSubMapper('OFS.DTMLMethod.DTMLMethod')
+    s = ObjectSerializer('OFS.DTMLMethod', 'DTMLMethod')
+    m.setSerializer(s)
+    s.addAspect('text', StringDataAttribute('raw'))
+    s.addAspect('id', id_aspect)
+    s.addAspect('remainder', remainder_aspect)
+    classifier.register('DTML Method', 'OFS.DTMLMethod.DTMLMethod', ('.dtml',))
+
+    # dtml document mapper
+    m = root_mapper.addSubMapper('OFS.DTMLDocument.DTMLDocument')
+    s = ObjectSerializer('OFS.DTMLDocument', 'DTMLDocument')
+    m.setSerializer(s)
+    s.addAspect('text', StringDataAttribute('raw'))
+    s.addAspect('properties', properties_aspect)
+    s.addAspect('id', id_aspect)
+    s.addAspect('remainder', remainder_aspect)
+    classifier.register('DTML Document', 'OFS.DTMLDocument.DTMLDocument')
+      
+    # zsql mapper
+    m = root_mapper.addSubMapper('Products.ZSQLMethods.SQL.SQL')
+    s = ObjectSerializer('Products.ZSQLMethods.SQL', 'SQL')
+    m.setSerializer(s)
+    s.addAspect('text', ZSQLMethodSerializer())
+    s.addAspect('properties', ZSQLMethodPropertiesSerializer())
+    s.addAspect('id', id_aspect)
+    s.addAspect('remainder', remainder_aspect)
+    classifier.register('Z SQL Method', 'Products.ZSQLMethods.SQL.SQL', (
+        '.sql', ))
+      
+    # python script mapper
+    m = root_mapper.addSubMapper('PythonScript') # abbreviated name
+    s = ObjectSerializer('Products.PythonScripts.PythonScript', 
+        'PythonScript')
+    m.setSerializer(s)
+    s.addAspect('body', PythonScriptSerializer())
+    s.addAspect('id', id_aspect)
+    s.addAspect('remainder', remainder_aspect)
+    classifier.register('Script (Python)', 'PythonScript', ('.py', ))
+
     # user folder mapper
     m = root_mapper.addSubMapper('AccessControl.User.UserFolder')
     s = ObjectSerializer('AccessControl.User', 'UserFolder')
     m.setSerializer(s)
     s.addAspect('data', UserFolderSerializer())
-    s.addAspect('id', IdAttribute())
-    s.addAspect('remainder', RemainingState())
+    s.addAspect('id', id_aspect)
+    s.addAspect('remainder', remainder_aspect)
     classifier.register('User Folder', 'AccessControl.User.UserFolder')
 
     # anyfolder mapper
@@ -108,16 +152,16 @@
     m.setSerializer(s)
     s.addAspect('items', folder_items_aspect)
     s.addAspect('properties', OptionalAspect(properties_aspect, []))
-    s.addAspect('id', IdAttribute())
-    s.addAspect('remainder', RemainingState())
+    s.addAspect('id', id_aspect)
+    s.addAspect('remainder', remainder_aspect)
     classifier.registerDefaultStorage('(folderish object)', 'anyfolder', 1)
 
     # anyfile mapper
     m = root_mapper.addSubMapper('anyfile')
     s = AnyObjectSerializer()
     m.setSerializer(s)
-    s.addAspect('id', IdAttribute())
-    s.addAspect('remainder', RemainingState())
+    s.addAspect('id', id_aspect)
+    s.addAspect('remainder', remainder_aspect)
     classifier.registerDefaultStorage('(fileish object)', 'anyfile', 0)
 
     # application mapper
@@ -126,7 +170,7 @@
     m.setSerializer(s)
     s.addAspect('properties', properties_aspect)
     s.addAspect('items', folder_items_aspect)
-    s.addAspect('remainder', RemainingState())
+    s.addAspect('remainder', remainder_aspect)
     classifier.registerKey(
         'Application', 'OFS.Application.Application', app_key)
 


=== Products/AdaptableStorage/Zope2SQL.py 1.10 => 1.11 ===
--- Products/AdaptableStorage/Zope2SQL.py:1.10	Fri Jan 10 11:08:19 2003
+++ Products/AdaptableStorage/Zope2SQL.py	Mon Feb  3 13:26:47 2003
@@ -66,6 +66,36 @@
     g.addGateway('remainder', remainder_gw)
     root_mapper.getSubMapper('ZopePageTemplate').setGateway(g)
 
+    # dtml method gateway
+    g = ObjectGateway()
+    g.addGateway('text', file_data_gw)
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
+    root_mapper.getSubMapper('OFS.DTMLMethod.DTMLMethod').setGateway(g)
+    
+    # dtml document gateway
+    g = ObjectGateway()
+    g.addGateway('text', file_data_gw)
+    g.addGateway('properties', properties_gw)
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
+    root_mapper.getSubMapper('OFS.DTMLDocument.DTMLDocument').setGateway(g)
+
+    # zsqlmethod mapper
+    g = ObjectGateway()
+    g.addGateway('text', file_data_gw)
+    g.addGateway('properties', properties_gw)
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
+    root_mapper.getSubMapper('Products.ZSQLMethods.SQL.SQL').setGateway(g)
+
+    # python script mapper
+    g = ObjectGateway()
+    g.addGateway('body', file_data_gw)
+    g.addGateway('id', item_id_gw)
+    g.addGateway('remainder', remainder_gw)
+    root_mapper.getSubMapper('PythonScript').setGateway(g)
+
     # file gateway
     g = ObjectGateway()
     g.addGateway('data', file_data_gw)