<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=191414202-29122003>I'm trying to create 
a custom tag that wraps it's contents in some flash sniffing javascript.  
The contents of the tag need to be executed as normal, as they could contain 
other albatross tags, and to do this I'm calling the Content's to_html 
method.  The Context class however is set to write to sys.out, and I need 
to stop this because I need to alter the results.  Here is what I'm 
trying:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=191414202-29122003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=191414202-29122003>import albatross, 
copy</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=191414202-29122003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=191414202-29122003>class 
NoFlash(albatross.EmptyTag, 
albatross.tags.EvalAttribMixin):<BR>    name = 
"alx-noflash"</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=191414202-29122003>class 
Flash(albatross.EnclosingTag, 
albatross.tags.EvalAttribMixin):<BR>    name = 
"alx-flash"</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=191414202-29122003>    
def __init__(self, ctx, filename, line_num, 
attribs):<BR>        
albatross.EnclosingTag.__init__(self, ctx, filename, line_num, 
attribs)<BR>        self.flash = 
self.content<BR>        self.noflash = 
albatross.Content()<BR>        
self.noflashseen = 0</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=191414202-29122003>    
def to_html(self, ctx):<BR>        dummy = 
copy.copy(ctx)<BR>        dummy.send_content 
= send_content<BR>        
self.flash.to_html(dummy)<BR>        
self.noflash.to_html(dummy)</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=191414202-29122003>    
def append(self, tag):<BR>        if 
isinstance(tag, NoFlash) or 
self.noflashseen:<BR>            
self.noflash.append(tag)<BR>            
self.noflashseen = 1<BR>        
else:<BR>            
self.flash.append(tag)</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=191414202-29122003>def 
send_content(data):<BR>    assert 0, data<BR>    
pass<BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=191414202-29122003>My assert is not 
going off.  If I don't do a copy.copy it will go off correctly, but since 
it's a reference I just killed the real send_content, and that's 
bad.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=191414202-29122003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=191414202-29122003>Any 
thoughts?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=191414202-29122003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=191414202-29122003>Mike</DIV></SPAN></FONT></BODY></HTML>