Commit 7b80be50 authored by 's avatar

Added delete protocol.

parent 1f497f69
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
# #
############################################################################## ##############################################################################
__doc__="""Copy interface""" __doc__="""Copy interface"""
__version__='$Revision: 1.33 $'[11:-2] __version__='$Revision: 1.34 $'[11:-2]
import sys, string, Globals, Moniker, tempfile, ExtensionClass import sys, string, Globals, Moniker, tempfile, ExtensionClass
from marshal import loads, dumps from marshal import loads, dumps
...@@ -212,7 +212,7 @@ class CopyContainer(ExtensionClass.Base): ...@@ -212,7 +212,7 @@ class CopyContainer(ExtensionClass.Base):
id=absattr(ob.id) id=absattr(ob.id)
if not ob.cb_isMoveable(): if not ob.cb_isMoveable():
raise CopyError, eNotSupported % id raise CopyError, eNotSupported % id
ob.aq_parent._delObject(id) ob.aq_parent._delObject(id, dp=0)
if hasattr(ob, 'aq_base'): if hasattr(ob, 'aq_base'):
ob=ob.aq_base ob=ob.aq_base
id=_get_id(self, id) id=_get_id(self, id)
...@@ -248,7 +248,7 @@ class CopyContainer(ExtensionClass.Base): ...@@ -248,7 +248,7 @@ class CopyContainer(ExtensionClass.Base):
title='Rename Error', title='Rename Error',
message=sys.exc_value, message=sys.exc_value,
action ='manage_main') action ='manage_main')
self._delObject(id) self._delObject(id, dp=0)
if hasattr(ob, 'aq_base'): if hasattr(ob, 'aq_base'):
ob=ob.aq_base ob=ob.aq_base
self._setObject(new_id, ob) self._setObject(new_id, ob)
......
...@@ -84,9 +84,9 @@ ...@@ -84,9 +84,9 @@
############################################################################## ##############################################################################
__doc__="""Object Manager __doc__="""Object Manager
$Id: ObjectManager.py,v 1.70 1999/04/30 14:12:56 brian Exp $""" $Id: ObjectManager.py,v 1.71 1999/05/05 14:58:34 brian Exp $"""
__version__='$Revision: 1.70 $'[11:-2] __version__='$Revision: 1.71 $'[11:-2]
import App.Management, Acquisition, App.Undo, Globals, CopySupport import App.Management, Acquisition, App.Undo, Globals, CopySupport
import os, App.FactoryDispatcher, ts_regex, Products import os, App.FactoryDispatcher, ts_regex, Products
...@@ -213,7 +213,7 @@ class ObjectManager( ...@@ -213,7 +213,7 @@ class ObjectManager(
object.manage_setLocalRoles(name, ['Owner']) object.manage_setLocalRoles(name, ['Owner'])
return id return id
def _delObject(self,id): def _delObject(self, id, dp=1):
if id=='acl_users': if id=='acl_users':
# Yikes - acl_users is referred to by two names and # Yikes - acl_users is referred to by two names and
# must be treated as a special case! Only get rid of # must be treated as a special case! Only get rid of
...@@ -224,7 +224,17 @@ class ObjectManager( ...@@ -224,7 +224,17 @@ class ObjectManager(
if hasattr(self, '__allow_groups__') and \ if hasattr(self, '__allow_groups__') and \
self.__dict__.has_key('__allow_groups__'): self.__dict__.has_key('__allow_groups__'):
delattr(self, '__allow_groups__') delattr(self, '__allow_groups__')
# Deletion protocol - when an object is being deleted,
# attempt to call it's _on_delete_object method if
# if has one. The dp flag allows allows callers to
# avoid having the delete protocol triggered (for
# instance when an object is cut and pasted).
if dp:
ob=self._getOb(id)
if hasattr(ob, '_on_delete_object') and \
callable(ob._on_delete_object):
ob._on_delete_object()
del ob
self._objects=tuple(filter(lambda i,n=id: i['id']!=n, self._objects)) self._objects=tuple(filter(lambda i,n=id: i['id']!=n, self._objects))
self._delOb(id) self._delOb(id)
......
...@@ -89,8 +89,8 @@ Aqueduct database adapters, etc. ...@@ -89,8 +89,8 @@ Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new This module can also be used as a simple template for implementing new
item types. item types.
$Id: SimpleItem.py,v 1.47 1999/04/28 16:25:45 brian Exp $''' $Id: SimpleItem.py,v 1.48 1999/05/05 14:58:34 brian Exp $'''
__version__='$Revision: 1.47 $'[11:-2] __version__='$Revision: 1.48 $'[11:-2]
import regex, sys, Globals, App.Management, Acquisition import regex, sys, Globals, App.Management, Acquisition
from webdav.Resource import Resource from webdav.Resource import Resource
...@@ -110,6 +110,14 @@ class Item(Base, Resource, CopySource, App.Management.Tabs): ...@@ -110,6 +110,14 @@ class Item(Base, Resource, CopySource, App.Management.Tabs):
isPrincipiaFolderish=0 isPrincipiaFolderish=0
isTopLevelPrincipiaApplicationObject=0 isTopLevelPrincipiaApplicationObject=0
# HACK HACK HACK -- TAKE THIS OUT LATER!!!!
def _on_delete_object(self):
if hasattr(self, 'onDeleteObject') and \
callable(self.onDeleteObject):
self.onDeleteObject()
# The name of this object and the name used to traverse to thie # The name of this object and the name used to traverse to thie
# object in a URL: # object in a URL:
id='' id=''
......
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