[Zope-dev] Callbacks

Scott Robertson sroberts@codeit.com
Tue, 20 Jul 1999 22:02:08 -0700 (PDT)


I'm trying to write a product that will use a  callback/hook schema. That
way a user can specify wether a DTMLMethod or a SQLMEthod should handle a
paticular error.

So I have an object with a function defined like this.

  def callback(self):
	"""Call back test"""
	func = getattr(self, 'ring')
	return apply(func, (self, globals()))


'ring' is a document method defined in the root folder. It finds this
object but when it tries to render 'ring' it can't find
standard_html_header and gives me this traceback.

Traceback (innermost last):
  File /home/sroberts/Zope/lib/python/ZPublisher/Publish.py, line 255, in
publish_module
  File /home/sroberts/Zope/lib/python/ZPublisher/Publish.py, line 161, in
publish
  File /home/sroberts/Zope/lib/python/ZPublisher/mapply.py, line 154, in
mapply
    (Object: callback)
  File /home/sroberts/Zope/lib/python/ZPublisher/Publish.py, line 98, in
call_object
    (Object: callback)
  File /home/sroberts/Zope/lib/python/Products/Wampum/WampumGenerator.py,
line 83, in callback
    (Object: wamp)
  File /home/sroberts/Zope/lib/python/OFS/DTMLMethod.py, line 158, in
__call__
    (Object: ring)
  File /home/sroberts/Zope/lib/python/OFS/DTMLMethod.py, line 154, in
__call__
    (Object: ring)
  File /home/sroberts/Zope/lib/python/DocumentTemplate/DT_String.py, line
514, in __call__
    (Object: ring)
KeyError: standard_html_header

	 
I thought that maybe this was an aquisition problem so I tried using the
__of__() call like this:

	return apply(func.__of__(self), (self, globals()))


This gave the same error.

Any thoughts?

---------------------------------------------------
- Scott Robertson             Phone: 714.972.2299 -
- CodeIt Computing            Fax:   714.972.2399 -
-                http://codeit.com                -
---------------------------------------------------