[Zope] Re: ZClass Bug (was: Re: [Zope] How to access id and title of document calling standard_html_header)

Tim Hicks Tim Hicks" <tim@sitefusion.co.uk
Thu, 7 Sep 2000 23:24:10 +0100


----- Original Message -----
From: "Dieter Maurer" <dieter@handshake.de>
To: "Tim Hicks" <tim@sitefusion.co.uk>
Sent: Thursday, September 07, 2000 7:00 PM
Subject: Re: ZClass Bug (was: Re: [Zope] How to access id and title of
document calling standard_html_header)


> Hi Tim
>
>  > NameError: theatre_class
>  >
>  > It would seem that <string> is still raising its head.  Any
ideas?
> I do not think so.
> You get a name error: Zope does not know your "theatre_class" at
> this point.
>
> It seems more likely, that DC changed to way ZClasses are located
> inside the constructor.
>
> Take the generated ZClass constructor and simply add
> the "...REQUEST.set..." before the "createInObjectManager".
>

OK, I'm so sorry about this, you've been an absolute legend so far,
and I really don't want to push my luck, but each time you solve
something, I find something else that has broken.

This is what my theatre_class_add method looks like (well, an excerpt
anyway).

<dtml-call "REQUEST.set('__name__', REQUEST['id'])">
<dtml-with "theatre_class.createInObjectManager(REQUEST['id'],
REQUEST)">

     <dtml-call
"propertysheets.theatre_class_property.manage_editProperties(REQUEST)"
>
     <dtml-call "manage_edit('<dtml-var
standard_html_header>\n\n<dtml-var standard_html_footer>', '')">

</dtml-with>


When I try to create a new instance of the zclass in the original
'site' folder (or any of its parent folders except for the root), I
get this error. I do not receive an error and everything works fine
when I create the instance in a new folder on a different 'branch' to
the original.

<traceback>
Traceback (innermost last):
  File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 222,
in publish_module
  File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 187,
in publish
    (Object: testing)
  File C:\PROGRA~1\Zope221\lib\python\Zope\__init__.py, line 221, in
zpublisher_exception_hook
    (Object: RoleManager)
  File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 171,
in publish
    (Object: testing)
  File C:\PROGRA~1\Zope221\lib\python\ZPublisher\mapply.py, line 160,
in mapply
    (Object: theatre_class_add)
  File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 112,
in call_object
    (Object: theatre_class_add)
  File C:\PROGRA~1\Zope221\lib\python\OFS\DTMLMethod.py, line 172, in
__call__
    (Object: theatre_class_add)
  File C:\PROGRA~1\Zope221\lib\python\DocumentTemplate\DT_String.py,
line 528, in __call__
    (Object: theatre_class_add)
  File C:\PROGRA~1\Zope221\lib\python\DocumentTemplate\DT_With.py,
line 133, in render
    (Object: theatre_class.createInObjectManager(REQUEST['id'],
REQUEST))
  File C:\PROGRA~1\Zope221\lib\python\DocumentTemplate\DT_Util.py,
line 337, in eval
    (Object: theatre_class.createInObjectManager(REQUEST['id'],
REQUEST))
    (Info: REQUEST)
  File &lt;string&gt;, line 0, in ?
NameError: theatre_class
</traceback>


When I try to copy and paste a zclass from this original 'site' folder
(or any of its parent folders except for the root), I get this error.
I do not receive an error and everything works fine when I copy and
paste an instance in a new folder on a different 'branch' to the
original.

"One or more items referred to in the clipboard data was not found.
The item may have been moved or deleted after you copied it."


When I try to rename a class that is in the original 'site' folder (or
any of its parent folders except for the root), I get this error. I do
not receive an error and everything works fine when I rename an
instance in a new folder on a different 'branch' to the original.

<traceback>
Traceback (innermost last):
  File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 222,
in publish_module
  File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 187,
in publish
  File C:\PROGRA~1\Zope221\lib\python\Zope\__init__.py, line 221, in
zpublisher_exception_hook
    (Object: Traversable)
  File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 171,
in publish
  File C:\PROGRA~1\Zope221\lib\python\ZPublisher\mapply.py, line 160,
in mapply
    (Object: manage_renameObjects)
  File C:\PROGRA~1\Zope221\lib\python\ZPublisher\Publish.py, line 112,
in call_object
    (Object: manage_renameObjects)
  File C:\PROGRA~1\Zope221\lib\python\OFS\CopySupport.py, line 273, in
manage_renameObjects
    (Object: Traversable)
  File C:\PROGRA~1\Zope221\lib\python\OFS\CopySupport.py, line 285, in
manage_renameObject
    (Object: Traversable)
  File C:\PROGRA~1\Zope221\lib\python\OFS\ObjectManager.py, line 236,
in _getOb
    (Object: Traversable)
AttributeError: (see above)
</traceback>

Like I say, you've been fantastic in helping me.  Thanks to you, I now
have a solution whereby I know I can redo all of the class instances I
have created, and be sure that the error won't reappear.  However, I'm
sure from what you have said so far, there is a way around this that
doesn't involve me 'writing off' all the instances that I have already
created.  My problem is, I'm a little out of my depth here!  I don't
understand the different behaviour between different folders.

If you haven't already got tired of this, thanks very much.

tim