[Zope-CVS] CVS: Products/AdaptableStorage/gateway_fs - FSConnection.py:1.4
Shane Hathaway
shane@zope.com
Mon, 23 Dec 2002 23:30:02 -0500
Update of /cvs-repository/Products/AdaptableStorage/gateway_fs
In directory cvs.zope.org:/tmp/cvs-serv30532/gateway_fs
Modified Files:
FSConnection.py
Log Message:
Provided a way to configure ObjectMappers, with the intent of making
AdaptableStorage easier to explain. Added IConfigurableObjectMapper
and converted all the mapper setup code to use it. Included a
checkConfiguration() method which validates the entire object mapper
tree. Then converted the DBTab-based configuration to use a mapper
factory, which can point to any mapper factory function installed
anywhere. Tangents to this:
- Refactored Zope2FS and Zope2SQL to use the same code for setting up
mappers, leaving "holes" for the gateways.
- Added connect() and close() methods to ITPCConnection (which doesn't
technically exist yet since I need to choose a name for it. ;-) )
- Factored out common parts of the SQL gateways.
- Implemented the newKey() method of IKeyedObjectSystem, which will
help ZEO environments, in theory.
=== Products/AdaptableStorage/gateway_fs/FSConnection.py 1.3 => 1.4 ===
--- Products/AdaptableStorage/gateway_fs/FSConnection.py:1.3 Thu Dec 5 12:38:46 2002
+++ Products/AdaptableStorage/gateway_fs/FSConnection.py Mon Dec 23 23:29:31 2002
@@ -281,16 +281,6 @@
'Data for a directory must be a list or tuple at %s'
% subpath)
- #
- # ITPCConnection implementation
- #
-
- def sortKey(self):
- return self.basepath
-
- def getName(self):
- return self.basepath
-
def queue(self, subpath, section_name, data, mode=WRITE_UNCONDITIONAL):
"""Queues data to be written at commit time"""
if mode == WRITE_UNCONDITIONAL:
@@ -315,6 +305,20 @@
else:
sections[section_name] = data
+ #
+ # ITPCConnection implementation
+ #
+
+ def sortKey(self):
+ return self.basepath
+
+ def getName(self):
+ return self.basepath
+
+ def connect(self):
+ if not os.path.exists(self.basepath):
+ os.makedirs(self.basepath)
+
def begin(self):
pass
@@ -360,4 +364,7 @@
self.writeFinal(subpath, sections)
finally:
self.reset()
+
+ def close(self):
+ pass