in my app, i write like this:

# code.py
def make_html(c):
    return c.replace('\r\n', '<br />')
...
web.template.Template.globals['make_html'] = make_html

# view.html
...
            <div class="entry_content">
                $make_html(entry.excerpt)
                $entry.content
            </div>
...

and the page display like this, eg:

>>> query("SELECT * FROM foo", _test=True) <br /> <sql: 'SELECT * FROM foo'><br
> /> >>>
>

it been displayed like html... it is not my what i want to display, i want
like this:

>>> query("SELECT * FROM foo", _test=True)
>
<sql: 'SELECT * FROM foo'>
>
>>>
>

so, i change it:
$:make_html(entry.excerpt)
..
yes, it works, but we know it's not safely, some html tag will breake our
page layout...
how can i do that? i want to change '\r\n' to '<br />', do not change other
html tag...

3Q :)


-- 
每个人都有一片属于自己的森林, 迷失的人迷失了, 相逢的还会再相逢...
Gtalk: iexper(at)gmail.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to