Commit f82c774f authored by Tres Seaver's avatar Tres Seaver

- LP #253362: Moved Zope2-specific moudle, ZODB/Mount.py, to

  Products/TemporaryFolder/mount.py (its only client is
  Products/TemporaryFolder/TemporaryFolder.py).

- Moved exception 'MountedStorageError' from 'ZODB.POSExceptions'
  to 'Products.TemporaryFolder.mount' (now its only client).

- Removed spurious import-time dependencies from
  Products/ZODBMountPoint/MountedObject.py.
parent efd6e26d
...@@ -9,6 +9,16 @@ Zope Changes ...@@ -9,6 +9,16 @@ Zope Changes
Restructuring Restructuring
- Moved exception MountedStorageError from ZODB.POSExceptions
to Products.TemporaryFolder.mount (now its only client).
- LP #253362: Moved Zope2-specific module, ZODB/Mount.py, to
Products/TemporaryFolder/mount.py (its only client is
Products/TemporaryFolder/TemporaryFolder.py).
- Removed spurious import-time dependencies from
Products/ZODBMountPoint/MountedObject.py.
- Removed Examples.zexp from the skeleton. The TTW shopping cart isn't - Removed Examples.zexp from the skeleton. The TTW shopping cart isn't
any good example of Zope usage anymore. any good example of Zope usage anymore.
......
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
""" """ Mounted database support
Mounted database support
A MountedTemporaryFolder is an object that is a mount point. It mounts a A MountedTemporaryFolder is an object that is a mount point. It mounts a
TemporaryStorage-backed database and masquerades as its root object. TemporaryStorage-backed database and masquerades as its root object.
...@@ -20,23 +19,20 @@ point object is called, and that returns a Folder object that actually ...@@ -20,23 +19,20 @@ point object is called, and that returns a Folder object that actually
lives in another ZODB. lives in another ZODB.
To understand this fully, you'll need to read the source of To understand this fully, you'll need to read the source of
ZODB.Mount.MountPoint. Products.TemporaryFolder.mount.MountPoint.
$Id$ $Id$
""" """
__version__='$Revision: 1.12 $'[11:-2] __version__='$Revision: 1.12 $'[11:-2]
import os, os.path from App.special_dtml import DTMLFile
from App.special_dtml import HTMLFile
import Globals
from Globals import HTMLFile
from ZODB.Mount import MountPoint
from OFS.Folder import Folder from OFS.Folder import Folder
from OFS.SimpleItem import Item from OFS.SimpleItem import Item
from ZODB.DB import DB
from tempstorage.TemporaryStorage import TemporaryStorage from tempstorage.TemporaryStorage import TemporaryStorage
from LowConflictConnection import LowConflictConnection from ZODB.DB import DB
from Products.TemporaryFolder.mount import MountPoint
ADD_TEMPORARY_FOLDER_PERM="Add Temporary Folder" ADD_TEMPORARY_FOLDER_PERM="Add Temporary Folder"
...@@ -48,14 +44,15 @@ def constructTemporaryFolder(self, id, title=None, REQUEST=None): ...@@ -48,14 +44,15 @@ def constructTemporaryFolder(self, id, title=None, REQUEST=None):
if REQUEST is not None: if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1) return self.manage_main(self, REQUEST, update_menu=1)
constructTemporaryFolderForm=HTMLFile('dtml/addTemporaryFolder', globals()) constructTemporaryFolderForm=HTMLFile('dtml/addTemporaryFolder', globals())
class SimpleTemporaryContainer(Folder): class SimpleTemporaryContainer(Folder):
# dbtab-style container class # dbtab-style container class
meta_type = 'Temporary Folder' meta_type = 'Temporary Folder'
icon = 'misc_/TemporaryFolder/tempfolder.gif' icon = 'misc_/TemporaryFolder/tempfolder.gif'
class MountedTemporaryFolder(MountPoint, Item): class MountedTemporaryFolder(MountPoint, Item):
""" """
A mounted RAM database with a basic interface for displaying the A mounted RAM database with a basic interface for displaying the
...@@ -73,7 +70,7 @@ class MountedTemporaryFolder(MountPoint, Item): ...@@ -73,7 +70,7 @@ class MountedTemporaryFolder(MountPoint, Item):
self.title = title self.title = title
MountPoint.__init__(self, path='/') # Eep MountPoint.__init__(self, path='/') # Eep
manage_traceback = Globals.DTMLFile('dtml/mountfail', globals()) manage_traceback = DTMLFile('dtml/mountfail', globals())
def _createDB(self, db=None): # huh? db=db was original def _createDB(self, db=None): # huh? db=db was original
""" Create a mounted RAM database """ """ Create a mounted RAM database """
......
This diff is collapsed.
...@@ -24,14 +24,15 @@ from logging import getLogger ...@@ -24,14 +24,15 @@ from logging import getLogger
import transaction import transaction
import Globals from App.class_init import default__class_init__ as InitializeClass
import Acquisition from Acquisition import ImplicitAcquisitionWrapper
from Acquisition import aq_base, aq_inner, aq_parent from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
from AccessControl.ZopeGuards import guarded_getattr from AccessControl.ZopeGuards import guarded_getattr
from OFS.SimpleItem import SimpleItem from OFS.SimpleItem import SimpleItem
from OFS.Folder import Folder from OFS.Folder import Folder
from Products.PageTemplates.PageTemplateFile import PageTemplateFile from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from ZODB.POSException import MountedStorageError, ConnectionStateError
LOG = getLogger('Zope.ZODBMountPoint') LOG = getLogger('Zope.ZODBMountPoint')
...@@ -215,11 +216,6 @@ class MountedObject(SimpleItem): ...@@ -215,11 +216,6 @@ class MountedObject(SimpleItem):
def _logConnectException(self): def _logConnectException(self):
'''Records info about the exception that just occurred. '''Records info about the exception that just occurred.
''' '''
try:
from cStringIO import StringIO
except:
from StringIO import StringIO
import traceback
exc = sys.exc_info() exc = sys.exc_info()
LOG.error('Failed to mount database. %s (%s)' % exc[:2], exc_info=exc) LOG.error('Failed to mount database. %s (%s)' % exc[:2], exc_info=exc)
f=StringIO() f=StringIO()
...@@ -234,7 +230,7 @@ class MountedObject(SimpleItem): ...@@ -234,7 +230,7 @@ class MountedObject(SimpleItem):
try: try:
return self._getOrOpenObject(parent) return self._getOrOpenObject(parent)
except: except:
return Acquisition.ImplicitAcquisitionWrapper(self, parent) return ImplicitAcquisitionWrapper(self, parent)
def _test(self, parent): def _test(self, parent):
...@@ -279,7 +275,7 @@ class MountedObject(SimpleItem): ...@@ -279,7 +275,7 @@ class MountedObject(SimpleItem):
return "%s(id=%s)" % (self.__class__.__name__, repr(self.id)) return "%s(id=%s)" % (self.__class__.__name__, repr(self.id))
Globals.InitializeClass(MountedObject) InitializeClass(MountedObject)
def getMountPoint(ob): def getMountPoint(ob):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment