I found how to do it. there may be other ways, but  the following
worked for me:

 <div py:replace="Markup(page.data)">Page text goes here.</div>

Genshi's Markup()  I assume told the template engine not to escape the
sequence and made the text appear  as valid HTML.

Thanks
Bogdan

On 26 Giu, 14:00, Bogdan Hlevca <[email protected]> wrote:
> Hi ,
>
> I have created a new Page object in order to make the site dynamic and
> be able to create page on demand if proper credentials are presented.
>
> The code is very similar to what is presented in the wiki20 tutorial.
> I want that the page.data content to be valid HTML. However, even
> though I put for example as  a link
> instead seeing something like
>
>         Powered by TurboGears 2
>
> the content is represented on the page as text and not interpreted as
> valid HTML  link, which can be clicked:
>
>         <a href="http://www.turbogears.org/2.0/";>Powered by TurboGears
> 2</a>
>
> Is there any way to hold in the database valid HTML code and insert it
> in the template as shown below?
> In the Admin view for DB, strangely enough, the page.data is shown as
> a link.  Therefore, I suppose that I need to do something at the
> template level, but I have no clue what.
>
> Any hints will be appreciated.
> Thanks,
> Bogdan
>
> The Page class:
> =============
> class Page(DeclarativeBase):
>     __tablename__ = 'pages'
>
>     id=Column(Integer, primary_key=True)
>     pagename=Column(Text, unique=True)
>     data=Column(Text)
>
>     def __init__(self, pagename, data):
>         self.pagename = pagename
>         self.data = data
>
> The page template:
> ==============
> <body>
>   ${sidebar_top()}
>     <div class="currentpage">
>      Now Viewing: <span py:replace="page.pagename"/>
>     </div>
>
> <div class="main_content">
>
>  <br/><br/>
>  <div py:replace="page.data">Page text goes here.</div>
>  <br/> <br/><br/>
>      <a href="/edit/${page.pagename}">Edit this page</a>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to