Never mind found it I guess my nicedit wasn't adding <p> tags but <br>

On Thu, Dec 9, 2010 at 10:12 AM, Andrew Evans <[email protected]> wrote:

> Hi Bruno ty for the reply.
>
> I am just trying to figure out that code but for some reason it isn't
> displaying the post_body when I view the page
>
> Any ideas in how to fix this?
>
> def index():
>     posts = db(db.posts.id > 0).select(orderby=~db.posts.id, limitby=(0,
> 10))
>     for post in posts:
>         if len(post.post_body) > 1000:                            # Preview
> should be about 1000 chars
>             index = post.post_body.find("</p>", 1000, -1) + 4     # find
> the index of the next </p> and add 4 chars
>             post.post_body = post.post_body[0:index]                   #
> replace the body of the post post with short version
>     return dict(rows=posts)
>

Reply via email to