Re: [Zope-dev] why cant i rename an object from an external method
Grrr That works fine. But it annoys me I cant use a standard function to that. I like to use a standard function and use the checking that someone else wrote. old_id = obj.id() new_id = ASPNTools.safetymunge(obj.id()) self = obj.aq_parent ob = obj self._delObject(old_id) if hasattr(ob, 'aq_base'): ob=ob.aq_base ob._setId(new_id) self._setObject(new_id, ob, set_owner=0) Thanks Shane... phew no Perl necessary. - Original Message - From: "Shane Hathaway" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 28, 2000 8:26 PM Subject: Re: [Zope-dev] why cant i rename an object from an external method Andy McKay wrote: Heres a treat. I'm trying to write an external method to rename objects. I have approx 10,000 to rename so a script would be nice. No problem I thought, imitate a forms manage_renameObject and CopySupport.py can do the work. Rename works fine from the web form, but not from a script. (ASPNTools.getsomeobjectsfromstring returns a bunch of objects, Ive tried replicating this with resolve_url and get different namespace error, could this be a clue?). I would try using _delObject and _setObject instead. manage_renameObject() does some security checks that don't apply in your case. Shane ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] why cant i rename an object from an external method
Heres a treat. I'm trying to write an external method to rename objects. I have approx 10,000 to rename so a script would be nice. No problem I thought, imitate a forms manage_renameObject and CopySupport.py can do the work. Rename works fine from the web form, but not from a script. (ASPNTools.getsomeobjectsfromstring returns a bunch of objects, Ive tried replicating this with resolve_url and get different namespace error, could this be a clue?). Heres my script: def search(self, REQUEST=None): l = ASPNTools.getsomeobjectsfromstring(self, REQUEST['path'], REQUEST) for obj in l: ob = obj.aq_parent # get the folder ob.manage_renameObject(obj.id(), 'Foo') return 'renamed' Here's my problem: The object 100BASEFX does not support this operation File d:\p4\Zope-dev\lib\python\Products\ASPN/Extensions/foo_rename.py, line 6, in search (Object: 100BASEFX) File d:\p4\Zope-dev\lib\python\OFS\CopySupport.py, line 288, in manage_renameObject (Object: Traversable) File d:\p4\Zope-dev\lib\python\OFS\CopySupport.py, line 406, in _verifyObjectPaste (Object: Traversable) Copy Error: (see above) There surely must be simple way of doing this so I dont have to resort to writing a Perl script to imitate the browser, please! Thanks in advance as ever. -- Andy McKay, Developer. ActiveState. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] why cant i rename an object from an external method
Andy McKay wrote: Heres a treat. I'm trying to write an external method to rename objects. I have approx 10,000 to rename so a script would be nice. No problem I thought, imitate a forms manage_renameObject and CopySupport.py can do the work. Rename works fine from the web form, but not from a script. (ASPNTools.getsomeobjectsfromstring returns a bunch of objects, Ive tried replicating this with resolve_url and get different namespace error, could this be a clue?). I would try using _delObject and _setObject instead. manage_renameObject() does some security checks that don't apply in your case. Shane ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )