[Zope-dev] dtml-in batching

richard@bizarsoftware.com.au richard@bizarsoftware.com.au
Mon, 22 Jan 2001 12:03:14 +1100


richard@bizarsoftware.com.au wrote:
> 
> The dtml-in batching mechanisms are quite difficult to debug - the DTML
> documentation I have has examples which break it and there's no indication
> of why. It turns out the DT_In renderwb() code gobbles all exceptions from
> the rendering of the previous and next blocks. I've hacked my code so that
> there's no try/except clause any more. I'm not sure what exception it's
> trying to catch, but could it perhaps be made a little more picky?

And here's a diff - I'm pretty sure this was the intended behaviour...


*** /tmp/DT_In.py.orig	Mon Jan 22 12:00:53 2001
--- DT_In.py	Mon Jan 22 12:00:58 2001
***************
*** 561,566 ****
--- 561,570 ----
                      # there are more items, without actually
                      # computing a length:
                      sequence[end]
+                 except IndexError:
+                     if self.elses: result=render(self.elses, md)
+                     else: result=''
+                 else:
                      pstart,pend,psize=opt(end+1-overlap,0,
                                            sz,orphan,sequence)
                      kw['next-sequence']=1
***************
*** 568,576 ****
                      kw['next-sequence-end-index']=pend-1
                      kw['next-sequence-size']=pend+1-pstart
                      result=render(section,md)
-                 except:
-                     if self.elses: result=render(self.elses, md)
-                     else: result=''
              else:
                  result = []
                  append=result.append
--- 572,577 ----


-- 
Richard Jones
richard@bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)