[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zope
Subject:    Re: [Zope] Problem with a python script
From:       Andreas Pakulat <ap125 () informatik ! uni-rostock ! de>
Date:       2003-05-23 15:30:37
[Download RAW message or body]

On 23.Mai 2003 - 10:16:40, Passin, Tom wrote:
> [Andreas Pakulat]
> > got a really weird problem here:
> > Error Type: ValueError
> > Error Value: unsupported format character '"' (0x22) at index 45
> > 
> > testing the following python script:
> > 
> >....
> > fmtstr += ' href="index_html?activetab=%d">%s</a></td>' 
> > %(lastelem,tabs[lastelem])
> > fmtstr += '<td class="headerborderwhite"><img src="%s" ' %(isrc)
> > fmtstr += ' width="10" height="10" 
> > style="display:block;width:2em;height:2em"></td></tr></table></td>'
> > fmtstr += '<td 
> > style="background-color:#FFFFFF;width:95%"><img src="%s"' %(spsrc)
> > 
> > fmtstr += ' width="3" height="3"></td></tr>'
> > 
> > return fmtstr
> 
> Even though Andreas is happy to have found the error, I would like to
> urge that Python scripts not be used to return markup at all.  Instead,
> return a data structure to the calling page and let the page format the
> data - either with dhtml or zpt, it doesn't matter in this regard.

I'm relatively new to Zope and ZPT and that way was the easiest to
accomplish the task. But I think I'll have a look again and try to get
that markup out of the scripts...

> 1)  They are designed exactly for taking data and formatting it into
> markup, so it is much easier to get the markup right and to spot errors.

But that can make the code very large. The same thing in ZPT has twice
the number of lines (and they were longer). And that was the reason for
putting it in a script, as I started with vi as editor, but that's
history now ;)

> 2) Page maintenance and changes in appearance are easy to do and do not
> affect the logic used in the scripts that create the data.

ACK

Andreas

-- 
Executive ability is prominent in your make-up.

[Attachment #3 (application/pgp-signature)]
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic