[Zope] getting the type of an object from within dtml ???

NABETH Thierry Thierry.NABETH@insead.fr
Mon, 26 Jun 2000 09:43:31 +0200


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01BFDF41.F194D256
Content-Type: text/plain;
	charset="iso-8859-1"

Hello,

>> would you please elaborate.... what are you trying to determine the type
of?

Sorry for my lack of clarity.

I would like to get the class of the object, just using dtml. (and without
using external method)

Typically, the idea would be to define a dtml method (for instance getclass)
that return the class
of the object, so that I could write:

--- in a dtml-method defined for a Class A, and that can be called from
instance
of class A or subclasses of A.
...
<br>My class is :<dtml-var getclass>
...


>> Zope namespace ... eventually the namespace will be explained and
documented better.

I believe this is not a matter of documentation.
It is just that is is uselessly too complicate.

Note:
I very much like some of the ideas behind Zope. (such as the good
integration
of an OO database in the system, use of a dynamic language, etc.)
But I can really not get used to some of the other aspects that are very
well
addressed by other systems, but are so poorly addressed by Zope such as:
  * the namespace.
  * bad integration with python.
  * can not change the inheritance tree once a class has been created.
    (I have tried one of the trick that was posted somewhere, but it does
not work 100%).
  * very bad support for pointers (object1 --> object2).

Thierry

Thierry Nabeth
Research Fellow
INSEAD CALT (the Centre for Advanced Learning Technologies)
http://www.insead.fr/CALT/


-----Original Message-----
From: alan runyan [mailto:runyaga@thisbox.com]
Sent: Monday, June 26, 2000 5:36 AM
To: Thierry Nabeth; zope@zope.org
Subject: Re: [Zope] geting the type of an object from within dtml ???


> I have unsuccessifully been trying to figure out ou to get the type of an
> object
> from withing html.

are you talking about a ZOPE object? remember if you are a DTML Method your
'meta_type' will return the container object (it doenst have its own
namespace)

you could try
<dtml-with object>
  <dtml-var meta_type>
</dtml-with>

> Python is supposed to have a function type(object) that return the type,
> but I was not able to find a way to call it. (and I would rather prefere
not
> to have
> to define an external function.).

would you please elaborate.... what are you trying to determine the type of?

> My problem seems to have to do with the Zope namespace (which model I
> believe is
> a real pain in the ass :-(((().

I agree.  _[_['blah']] is probably the nastiest thing I've ever seen.  and
then someone will start adding lambdas to it and it will be all crap to
maintain from there... :(  eventually the namespace will be explained and
documented better, this is mainly a python/ZOPE framework idea that needs to
be experienced.  I still dont 100% get it.  I can usually make things work,
but sometimes I just dont quite 'get it'.

>
> Any suggestion, ideas ?

be abit more specific, you using python methods,. external methods, or
trying to do this from within DTML?

~runyaga


------_=_NextPart_001_01BFDF41.F194D256
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2650.12">
<TITLE>RE: [Zope] getting the type of an object from within dtml ???</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Hello,</FONT>
</P>

<P><FONT SIZE=2>&gt;&gt; would you please elaborate.... what are you trying to determine the type of?</FONT>
</P>

<P><FONT SIZE=2>Sorry for my lack of clarity.</FONT>
</P>

<P><FONT SIZE=2>I would like to get the class of the object, just using dtml. (and without using external method)</FONT>
</P>

<P><FONT SIZE=2>Typically, the idea would be to define a dtml method (for instance getclass) that return the class</FONT>
<BR><FONT SIZE=2>of the object, so that I could write:</FONT>
</P>

<P><FONT SIZE=2>--- in a dtml-method defined for a Class A, and that can be called from instance</FONT>
<BR><FONT SIZE=2>of class A or subclasses of A.</FONT>
<BR><FONT SIZE=2>...</FONT>
<BR><FONT SIZE=2>&lt;br&gt;My class is :&lt;dtml-var getclass&gt;</FONT>
<BR><FONT SIZE=2>...</FONT>
</P>
<BR>

<P><FONT SIZE=2>&gt;&gt; Zope namespace ... eventually the namespace will be explained and</FONT>
<BR><FONT SIZE=2>documented better.</FONT>
</P>

<P><FONT SIZE=2>I believe this is not a matter of documentation.</FONT>
<BR><FONT SIZE=2>It is just that is is uselessly too complicate.</FONT>
</P>

<P><FONT SIZE=2>Note:</FONT>
<BR><FONT SIZE=2>I very much like some of the ideas behind Zope. (such as the good integration</FONT>
<BR><FONT SIZE=2>of an OO database in the system, use of a dynamic language, etc.)</FONT>
<BR><FONT SIZE=2>But I can really not get used to some of the other aspects that are very well</FONT>
<BR><FONT SIZE=2>addressed by other systems, but are so poorly addressed by Zope such as:</FONT>
<BR><FONT SIZE=2>&nbsp; * the namespace.</FONT>
<BR><FONT SIZE=2>&nbsp; * bad integration with python.</FONT>
<BR><FONT SIZE=2>&nbsp; * can not change the inheritance tree once a class has been created.</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; (I have tried one of the trick that was posted somewhere, but it does not work 100%).</FONT>
<BR><FONT SIZE=2>&nbsp; * very bad support for pointers (object1 --&gt; object2).</FONT>
</P>

<P><FONT SIZE=2>Thierry</FONT>
</P>

<P><FONT SIZE=2>Thierry Nabeth</FONT>
<BR><FONT SIZE=2>Research Fellow</FONT>
<BR><FONT SIZE=2>INSEAD CALT (the Centre for Advanced Learning Technologies)</FONT>
<BR><FONT SIZE=2><A HREF="http://www.insead.fr/CALT/" TARGET="_blank">http://www.insead.fr/CALT/</A></FONT>
</P>
<BR>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: alan runyan [<A HREF="mailto:runyaga@thisbox.com">mailto:runyaga@thisbox.com</A>]</FONT>
<BR><FONT SIZE=2>Sent: Monday, June 26, 2000 5:36 AM</FONT>
<BR><FONT SIZE=2>To: Thierry Nabeth; zope@zope.org</FONT>
<BR><FONT SIZE=2>Subject: Re: [Zope] geting the type of an object from within dtml ???</FONT>
</P>
<BR>

<P><FONT SIZE=2>&gt; I have unsuccessifully been trying to figure out ou to get the type of an</FONT>
<BR><FONT SIZE=2>&gt; object</FONT>
<BR><FONT SIZE=2>&gt; from withing html.</FONT>
</P>

<P><FONT SIZE=2>are you talking about a ZOPE object? remember if you are a DTML Method your</FONT>
<BR><FONT SIZE=2>'meta_type' will return the container object (it doenst have its own</FONT>
<BR><FONT SIZE=2>namespace)</FONT>
</P>

<P><FONT SIZE=2>you could try</FONT>
<BR><FONT SIZE=2>&lt;dtml-with object&gt;</FONT>
<BR><FONT SIZE=2>&nbsp; &lt;dtml-var meta_type&gt;</FONT>
<BR><FONT SIZE=2>&lt;/dtml-with&gt;</FONT>
</P>

<P><FONT SIZE=2>&gt; Python is supposed to have a function type(object) that return the type,</FONT>
<BR><FONT SIZE=2>&gt; but I was not able to find a way to call it. (and I would rather prefere</FONT>
<BR><FONT SIZE=2>not</FONT>
<BR><FONT SIZE=2>&gt; to have</FONT>
<BR><FONT SIZE=2>&gt; to define an external function.).</FONT>
</P>

<P><FONT SIZE=2>would you please elaborate.... what are you trying to determine the type of?</FONT>
</P>

<P><FONT SIZE=2>&gt; My problem seems to have to do with the Zope namespace (which model I</FONT>
<BR><FONT SIZE=2>&gt; believe is</FONT>
<BR><FONT SIZE=2>&gt; a real pain in the ass :-(((().</FONT>
</P>

<P><FONT SIZE=2>I agree.&nbsp; _[_['blah']] is probably the nastiest thing I've ever seen.&nbsp; and</FONT>
<BR><FONT SIZE=2>then someone will start adding lambdas to it and it will be all crap to</FONT>
<BR><FONT SIZE=2>maintain from there... :(&nbsp; eventually the namespace will be explained and</FONT>
<BR><FONT SIZE=2>documented better, this is mainly a python/ZOPE framework idea that needs to</FONT>
<BR><FONT SIZE=2>be experienced.&nbsp; I still dont 100% get it.&nbsp; I can usually make things work,</FONT>
<BR><FONT SIZE=2>but sometimes I just dont quite 'get it'.</FONT>
</P>

<P><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; Any suggestion, ideas ?</FONT>
</P>

<P><FONT SIZE=2>be abit more specific, you using python methods,. external methods, or</FONT>
<BR><FONT SIZE=2>trying to do this from within DTML?</FONT>
</P>

<P><FONT SIZE=2>~runyaga</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01BFDF41.F194D256--