[Zope-dev] render method in DTML extentions

Stuart 'Zen' Bishop zen@cs.rmit.edu.au
Wed, 27 Oct 1999 15:31:14 +1000 (EST)


I've think I just fixed a bug in the Logger product, but am not sure if
it is a good fix or not.


    def render(self,md):
        subsystem = self.args['subsystem']
        severity  = severities[self.args['severity']]
        if hasattr(md,'this'):
            summary = self.sectionSummary(md.this,md)
        else:
            summary = self.sectionSummary(None,md)

The code I stole from SendmailTag.py simply retrieved a string by
using self.sectionSummary(md.this,md), but I managed to blow this up
with a wierd calling path where 'md.this' didn't exist (A DTML method
added to python class with HTMLFile calling a DTML method defined in ZODB).
So I added the 'if hasattr' section.

Does this indicate a bug in SendmailTag, or in whatever constructs
the md object? I havn't been able to trace this strange md object yet
but I suspect it is buried in cDocumentTemplate.c (*shudder*). 

 ___
   //     Zen (alias Stuart Bishop)     Work: zen@cs.rmit.edu.au
  // E N  Senior Systems Alchemist      Play: zen@shangri-la.dropbear.id.au
 //__     Computer Science, RMIT 	 WWW: http://www.cs.rmit.edu.au/~zen