Hi All, I am using Plone to provide the look and feel for my application. When I embed the page macros in a html file Zope renders the macros wonderfully. However when I use a Python script to generate html using print statements it doesn't appear to be working. The code looks something like this: print '<html metal:use-macro="here/dialup_template/macros/dialup"></html>' Then some more dynamic HTML in Python.... print '<div class="footer" metal:use-macro="here/footer/macros/portal_footer">Footer</div>' return printed Any suggestions? Thanks in advance.
D. Bickle wrote:
The code looks something like this: print '<html metal:use-macro="here/dialup_template/macros/dialup"></html>'
Then some more dynamic HTML in Python....
print '<div class="footer" metal:use-macro="here/footer/macros/portal_footer">Footer</div>' return printed
Not sure what you're expecting to have happen here... the statement: print '<div class="footer" metal:use-macro="here/footer/macros/portal_footer">Footer</div>' ...is not going to invoke the ZPT parser, compiler or renderer. Why are you trying to assemble stuff like this in a python script? I'd turn your python script into a ZPT and just do the substitutions there as normal... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Thanks for the feedback. As I am just a network engineer and not a web developer I am just interested in a quick-and-dirty solution to maintaining the same look-and-feel for my pages. The python solution just proved (to me a least) to be a quick and efficient way to build a dynamic content. Not wanting to spend huge amounts of time retooling my pages I need to know of a way of embedding the Plone macros in pages that are generated in Python (so I can go back to resolving networking issues). Does such a solution exist or is using ZPT my only option? On Thu, 11 Mar 2004, Chris Withers wrote:
D. Bickle wrote:
The code looks something like this: print '<html metal:use-macro="here/dialup_template/macros/dialup"></html>'
Then some more dynamic HTML in Python....
print '<div class="footer" metal:use-macro="here/footer/macros/portal_footer">Footer</div>' return printed
Not sure what you're expecting to have happen here...
the statement:
print '<div class="footer" metal:use-macro="here/footer/macros/portal_footer">Footer</div>'
...is not going to invoke the ZPT parser, compiler or renderer.
Why are you trying to assemble stuff like this in a python script?
I'd turn your python script into a ZPT and just do the substitutions there as normal...
cheers,
Chris
-- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
D. Bickle wrote:
Does such a solution exist or is using ZPT my only option?
Using ZPT is by far and away going to cause you the least pain to implement ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (2)
-
Chris Withers -
D. Bickle