[Zope] Re: Instance Conversion

Kent Polk kent@goathill.org
Fri, 5 Feb 1999 12:50:10 -0600 (CST)


From:  Brian Lloyd <Brian@digicool.com>

> Subject:  RE: [Zope] Instance conversion

> > I am having trouble attempting to access a Confera Topic instance
> > given it's string name.
> > 
> > However, I can't figure out how to retrieve the Topic Instance
> > given the string name 'testConfera'. I can get several different
> > types of instances (such as <ResultSet instance at xx>, but not
> > a Topic Instance.
 
> If, for example, you passed in the name of the Confera in 
> question as the form variable 'confera_name', you should
> be able to do either:
> 
>  <!--#var "_.getattr(this(), confera_name)"-->
> 
> or simply:
> 
>  <!--#var "_[confera_name]"-->
> 
> ...the main difference is that the second form will try to 
> call the object automatically, which is in some cases not
> what you want - either method should work for a Confera
> though.
 
Interesting...  Only the first form works though (the list
version returns the wrong instance type, as mentioned in the
first posting):

<!--#var "testConfera"-->
<!--#var "_['testConfera']"-->
<!--#var "_.getattr(this(), 'testConfera')"-->
<!--#var "_.getattr(this(), 'testConfera').has_items()"-->

results in:

<Topic instance at 7850e0>
<ResultSet instance at 4eb550>
<Topic instance at 7850e0>
1

Thanks!