Hi,

I am a bit new to this python and app engine stuff, but the docs have
failed me. I am trying to do something quite simple - display a list
of items:

class PageInfo:
    def __init__(self, url, hash, description):
        self.url = url
        self.hash = hash
        self.desctiption = description

class NewUser(webapp.RequestHandler):
    def get(self):
        urls_list = ['http://news.bbc.co.uk/1/hi/also_in_the_news/
default.stm',
                     'http://news.bbc.co.uk/1/hi/entertainment/
default.stm']

        descriptions_list = ['Odd stories',
                             'Entertainment']

        # Pack up the data
        data = []
        for index in range( 0, len( urls_list ) ):
            data.append( PageInfo( urls_list[index], hash,
descriptions_list[index] ) )

        template_values = {'data': data}

        path = os.path.join(os.path.dirname(__file__), 'foo.htm')
        self.response.out.write(template.render(path,
template_values))


foo.htm:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>

<body>

    {% for item in data %}
        <a href="{{ data.url }}">hello</a>
    {% endfor %}

</body>
</html>


I don't get any errors and I the template goes around the list twice
but data.url is not expanded to anything. If I replace the
template.render call with a loop through the data dictionary and just
spit out the URLs it works, but clearly that is not quite what I am
after!

Thanks for you help,

Dooferlad

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to