Hey guys.  I just went through the super beginner video tutorial on
the homepage of Google App Engine.

http://www.youtube.com/watch?v=bfgO-LXGpTM

And everything works except for the part where it lists a blank user
as Anonymous.  I was just wondering if I'm missing something?  I
pretty much copied the tut word for word.

My output page looks like this...
A message with an author from Tyler
No author message from
Test message. from
Hello world. from Tyler

It's supposed to say Anonymous instead of just being blank.

Here is my code...

<form action="" method="post">
        <p>From: <input type="text" name="who" value="" id="who"></p>
        <p>Message: <input type="text" name="message"  id="message"></p>
        <p><input type="submit" value="Shout"></p>
</form>

{% for shout in shouts %}
<div>
        {{shout.message}}
        from
        {% ifequal shout.who None %}
          Anonymous
        {% else %}
          {{shout.who}}
        {% endifequal %}
</div>
{% endfor %}

AND

import wsgiref.handlers
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template

class Shout(db.Model):
        message = db.StringProperty(required=True)
        when = db.DateTimeProperty(auto_now_add=True)
        who = db.StringProperty()

class MyHandler(webapp.RequestHandler):
  def get(self):
    shouts = db.GqlQuery('SELECT * FROM Shout ORDER BY when DESC')
    values = {'shouts':shouts}
    self.response.out.write(template.render('main.html', values))
  def post(self):
        shout = Shout(
          message=self.request.get('message'),
          who=self.request.get('who'))
        shout.put()
        self.redirect('/')
        self.response.out.write("posted")


def main():
  application = webapp.WSGIApplication([('/', MyHandler)],
                                       debug=True)
  wsgiref.handlers.CGIHandler().run(application)


if __name__ == '__main__':
  main()

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to