[Zope] Re: Cannot delete Object with wrong metatype
Helmut Toplitzer
helmut@ifit.uni-klu.ac.at
Fri, 12 May 2000 19:16:56 +0200
This is a multi-part message in MIME format.
--------------7642D09A6B8B7CFFDE80AC01
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Helmut Toplitzer wrote:
>
> Hi!
>
> I'm trying to make a website for some weeks now and
> yesterday a noticed a real problem for me.
>
> One of the standardfiles index_html (DTML Method)
> changed it's metatype to a !Folder!
>
> I've tried to delete it several times with no
> success.
>
> Has someone a idea how to make it work again?
>
> Helmut
Hi!
Its me again. I found a solution for the above Problem:
Ist not the wrong metatype (it just looks like)
its of the wrong class (broken product).
I found the folowing solution for this (with a few
deletions on the marked ---> lines becaus i cant patch
the original file. marked lines deleted in original file.)
(Solution from http://classic.zope.org:8080/Collector/1183/view )
After this patch try to delete the object, it should work.
(maybe only in my case)
When it's done, replace with the old file (lib/python/OFS/.)
and restart, because of no warenties.
--- ObjectManager.py 2000/05/11 18:54:14
1.89
+++ ObjectManager.py 2000/05/12 01:19:43
@@ -99,9 +99,13 @@
import marshal
import App.Common
---> from AccessControl import getSecurityManager
---> +from zLOG import LOG, ERROR
+import sys
bad_id=ts_regex.compile('[^a-zA-Z0-9-_~\,\.
]').search #TS
+class BeforeDeleteException( Exception ): pass #
raise to veto deletion
+
_marker=[]
class ObjectManager(
CopySupport.CopyContainer,
@@ -271,12 +275,26 @@
for object in self.objectValues():
try: s=object._p_changed
except: s=0
- object.manage_beforeDelete(item,
container)
+ try:
+
object.manage_beforeDelete(item, container)
----> + except BeforeDeleteException,
ob:
----> + raise
+ except:
----> +
LOG('Zope',ERROR,'manage_beforeDelete() threw',
----> + error=sys.exc_info())
+ pass
if s is None: object._p_deactivate()
def _delObject(self, id, dp=1):
object=self._getOb(id)
- object.manage_beforeDelete(object, self)
+ try:
+ object.manage_beforeDelete(object,
self)
----> + except BeforeDeleteException, ob:
----> + raise
+ except:
----> +
LOG('Zope',ERROR,'manage_beforeDelete() threw',
----> + error=sys.exc_info())
+ pass
self._objects=tuple(filter(lambda
i,n=id: i['id']!=n, self._objects))
self._delOb(id)
--------------7642D09A6B8B7CFFDE80AC01
Content-Type: text/x-vcard; charset=us-ascii;
name="helmut.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Helmut Toplitzer
Content-Disposition: attachment;
filename="helmut.vcf"
begin:vcard
n:Toplitzer;Helmut
tel;fax:++43 463/2700 505
tel;work:++43 463/2700 6247
x-mozilla-html:FALSE
org:Universität Klagenfurt;Institut für Wirtschaftsinformatik und Anwendungssysteme (IWAS)
adr:;;Universitaetsstrasse 65-67;Klagenfurt;Kaernten;9020;Austria
version:2.1
email;internet:helmut@ifit.uni-klu.ac.at
note:Praktische Informatik
x-mozilla-cpt:;0
fn:HelmutToplitzer
end:vcard
--------------7642D09A6B8B7CFFDE80AC01--