[Zope] Indirect method lookup? (Update)

Jeff Hoffman jeff.hoffman@goingv.com
Mon, 21 Aug 2000 16:14:22 -0400 (EDT)


Ok, knowing more about what's going on, now, I figured I would send an
update to the list and hope it jars someone's memory.

Here's what I am trying to do:

I have a ZClass, MyTestClass. MyTestClass has two methods: method1, and
method2. There are two other methods, showMethods and showMethods2, but
they are only needed for the purpose of demonstration.

I created an instance of MyTestClass with an id of 'test'.

showMethods (a DTMLMethod) is defined as:

  <dtml-var standard_html_header>
  <p>
  method1 = <dtml-var "_.hasattr(this(), 'method1')"><br>
  method2 = <dtml-var "_.hasattr(this(), 'method2')"><br>
  nullmethod = <dtml-var "_.hasattr(this(), 'nullmethod')">
  </p>

  <dtml-var standard_html_footer>

and, when invoked on my 'test' instance, returns:

  method1 = 1
  method2 = 1
  nullmethod = 0

We're cookin'. Now, I need to get the same results with a PythonMethod.
showMethods2 (a PythonMethod) is defined as:

  print _.hasattr(self, 'method1')
  print _.hasattr(self, 'method2')
  print _.hasattr(self, 'nullmethod')
  return printed

which, when invoked on my 'test' instance, returns:

  0
  0
  0

I have tried every permutation of Python code I can, and none work as the
DTML Method does. Somebody? Anybody? :-)

--Jeff

---
Jeff K. Hoffman                               704.849.0731 x108
Chief Technology Officer                      mailto:jeff.hoffman@goingv.com
Going Virtual, L.L.C.                         http://www.goingv.com/