Return values for html display?
So, I have set up some external methods that do some stuff, and I ultimately want to display html from them. However, I find the only way I can do this is to return it from my function. print() seems only to send it to the zserver log. Soooo, my question is, is this by design? Is there some way to get print() to actually shoot html to the page the end user sees? Is there a reason I wouldn't want to do this? -- "Most of us, when all is said and done, like what we like and make up reasons for it afterwards." -- Soren F. Petersen
On Sat, Dec 04, 1999 at 11:32:01PM -0700, jiva@devware.com wrote:
So, I have set up some external methods that do some stuff, and I ultimately want to display html from them. However, I find the only way I can do this is to return it from my function. print() seems only to send it to the zserver log. Soooo, my question is, is this by design? Yes. I'd guess that the internals of Zope use print() to output debug messages and there's some IO redirection going on that dumps it to the log file.
Is there some way to get print() to actually shoot html to the page the end user sees? If you must, build an output string as you go along and then return the string at the end of the method. But, this isn't the ideal mechanism.
Is there a reason I wouldn't want to do this? From what I've gathered by my limited exposure to it, Zope is about seperating presentation (HTML) and content (the data inside of the HTML). There's an easier way to build a page than in straight Python. Either call your ExternalMethod from a DTML Document, or use the DocumentTemplate package to create HTML on the fly. A JDBC book (Java Database API) I've got preaches against combining two programming languages (HTML + Python) because the resulting mess can be difficult to maintain.
-- "Most of us, when all is said and done, like what we like and make up reasons for it afterwards." -- Soren F. Petersen
Good quote!
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope No cross posts or HTML encoding! (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Stephen Pitts smpitts@midsouth.rr.com webmaster - http://www.mschess.org
participants (2)
-
jiva@devware.com -
Stephen Pitts