[Zope] geting the type of an object from within dtml ??? ==> it works

Chris McDonough chrism@digicool.com
Mon, 26 Jun 2000 11:38:26 -0400


in an external method, would not this work?:

def getclass(self, ob):
    return type(ob)

Then use the getclass fn from DTML:

 <dtml-var "getclass(anobject)">



-----Original Message-----
From: NABETH Thierry [mailto:Thierry.NABETH@insead.fr]
Sent: Monday, June 26, 2000 4:11 AM
To: 'zope@zope.org'
Cc: 'ethan mindlace fremen'
Subject: RE: [Zope] geting the type of an object from within dtml ???
==> it works


Hello, 
>> <dtml-var "meta_type"> works. 
Yes, it display the correct meta type. Thanks. 
When I had done some tests, I forgot to set the meta_type field, 
and the system was displaying the meta type of the superclass instead. 
(which had confused me). 
Note: 
I am still not very confortable to use the "meta_type" field to get the
class name, 
and would rather have prefered to have the real class itself. (python
type function). 



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


-----Original Message----- 
From: ethan mindlace fremen [mailto:mindlace@digicool.com] 
Sent: Monday, June 26, 2000 3:43 AM 
To: Thierry Nabeth 
Cc: zope@zope.org 
Subject: Re: [Zope] geting the type of an object from within dtml ??? 


Thierry Nabeth wrote: 
> for instance: 
> <dtml-var meta_type> 
> does not return the correct type. 
<dtml-var "meta_type"> works.  You can also use things like 
<dtml-in "objectValues(['DTML Document'])"> 
hope that helps, 
-- 
ethan mindlace fremen 
Zopatista Community Liason