DTML ZClass ID Bug
I had submitted this to Collector about a month ago, and have since wrote an external method to get around creating them with id's. If you create a ZClass instance based on DTMLMethod or Document through the web interface you end up with an object that has no id. (Or at least no way to see it outside the management screens) If you create the same object in python using: from DateTime import DateTime from OFS import DTMLMethod def make_resume(rfile,id,title) ob=ob.__of__(self) if rfile: my_ob=self.Control_Panel.Products.MyClass() my_ob.id=id my_ob.propertysheets.MyProperties.manage_changeProperties( myproperty=rfile.read()) my_ob.manage_edit("""<!--#var standard_html_header--><!--#var myproperty--><!--#var standard_html_footer-->""",title) my_ob=my_ob.__of__(ob) ob._setObject(id, my_ob) You get an id just fine. It acts like any other web created ZClass instance. I hope DC fixes this soon. It's really hampering not being able to extend DTMLDocuemnts and DTML Methods as Zclasses. All my best, -- Jason Spisak webmaster@hiretechs.com Date: Wed, 20 Oct 1999 19:50:33 +0200 To: zope-dev@zope.org From: Alexandre Ratti <ratti@dial.oleane.com> Subject: [Zope-dev] Re: DTML Zclass ID bug - HELP! Cc: Anthony Pfrunder <s341625@student.uq.edu.au> Hello, Did anyone solve the problem describe by Anthony below ? I'd really like to know because it sounds suspiciously like one of my own ZClass ailments: I can't access a ZClass instance ID and I can't display its value on a property sheet. Thanks. Alexandre At 13:00 17/10/1999 -0700, you wrote: >I've run into a really annoying bug and was wondering if it is fixed in >the CVS version (I don't have direct internet access to check). > >Create a new Product containing a Zclass subclassing from the DTML >Document or Method. Add a Python or DTML Method which does: > > This document is <dtml-var id> > >Then, add an instance of this Zclass. When you VIEW it you get: > > This document is <cstring ...> > >AND when you edit it the ID is empty. All references to the ID and >related internal variables return CSTRING or cause tracebacks. How do i >get the REAL id?
Hello, Thanks for your input Jason. I created a new CatalogAware ZClass without subclassing DTMLMethod and Document. The new ZClass instances work fine and they have an ID that can be retrieve from DTML. The only thing that puzzles me is that they cannot be cut and pasted around. They can be duplicated but not moved with cut and paste. It triggers an AttributeError (copied below) in the CatalogAware object. Did anyone solve this issue? Cheers. Alexandre --- Error message -- Error Type: AttributeError Error Value: REQUEST Traceback (innermost last): File D:\ZOPE\GISTI\lib\python\ZPublisher\Publish.py, line 214, in publish_module File D:\ZOPE\GISTI\lib\python\ZPublisher\Publish.py, line 179, in publish File D:\ZOPE\GISTI\lib\python\Zope\__init__.py, line 201, in zpublisher_exception_hook (Object: ElementWithAttributes) File D:\ZOPE\GISTI\lib\python\ZPublisher\Publish.py, line 165, in publish File D:\ZOPE\GISTI\lib\python\ZPublisher\mapply.py, line 160, in mapply (Object: manage_pasteObjects) File D:\ZOPE\GISTI\lib\python\ZPublisher\Publish.py, line 102, in call_object (Object: manage_pasteObjects) File D:\ZOPE\GISTI\lib\python\OFS\CopySupport.py, line 225, in manage_pasteObjects (Object: ElementWithAttributes) File D:\ZOPE\GISTI\lib\python\OFS\ObjectManager.py, line 264, in _delObject (Object: ElementWithAttributes) File D:\Zope\Gisti\lib\python\Products\ZCatalog\CatalogAwareness.py, line 130, in manage_beforeDelete (Object: CatalogAware) File D:\Zope\Gisti\lib\python\Products\ZCatalog\CatalogAwareness.py, line 187, in unindex_object (Object: CatalogAware) File D:\Zope\Gisti\lib\python\Products\ZCatalog\CatalogAwareness.py, line 157, in url (Object: CatalogAware) File D:\ZOPE\GISTI\lib\python\OFS\SimpleItem.py, line 316, in absolute_url (Object: CatalogAware) AttributeError: (see above) ---- At 17:52 20/10/1999 -0400, Jason Spisak wrote:
I had submitted this to Collector about a month ago, and have since wrote an external method to get around creating them with id's.
If you create a ZClass instance based on DTMLMethod or Document through the web interface you end up with an object that has no id. (Or at least no way to see it outside the management screens)
If you create the same object in python using:
from DateTime import DateTime from OFS import DTMLMethod
def make_resume(rfile,id,title) ob=ob.__of__(self) if rfile: my_ob=self.Control_Panel.Products.MyClass() my_ob.id=id my_ob.propertysheets.MyProperties.manage_changeProperties( myproperty=rfile.read()) my_ob.manage_edit("""<!--#var standard_html_header--><!--#var myproperty--><!--#var standard_html_footer-->""",title) my_ob=my_ob.__of__(ob) ob._setObject(id, my_ob)
You get an id just fine. It acts like any other web created ZClass instance.
I hope DC fixes this soon. It's really hampering not being able to extend DTMLDocuemnts and DTML Methods as Zclasses.
All my best,
-- Jason Spisak webmaster@hiretechs.com
(snip)
Alexandre, Have you heard anything about the ID bug from ZClasses derived from DTMLMethod/Document? If anyone knows what the status on this fix is, I would greatly appreciate an update. As it stands, you cannot subclass DTMLMethod or Document without having the 'id' property render the object useless. All my best, Jason Spisak webmaster@hiretechs.com
Jason, I uploaded today a draft howto about this bug. It describes a solution offered by Toby Dickenson. This worked for me so far. You can view the howto here: http://www.zope.org/Members/AlexR/ZClassIDBug Feel free to send me your feedback. On the other hand, I haven't solved the cut and paste problem yet (I get an error when cutting and pasting CatalogAware class instances). Cheers. Alexandre At 09:13 26/10/1999 +0000, Jason Spisak wrote:
Alexandre,
Have you heard anything about the ID bug from ZClasses derived from DTMLMethod/Document?
If anyone knows what the status on this fix is, I would greatly appreciate an update.
As it stands, you cannot subclass DTMLMethod or Document without having the 'id' property render the object useless.
All my best,
Jason Spisak webmaster@hiretechs.com
participants (3)
-
Alexandre Ratti -
Jason Spisak -
Jason Spisak