[google-appengine] Re: INPUT-OUTPUT applications using DATASTORE

2008-11-20 Thread Marzia Niccolai
Hi Costas,

What kind of errors are you seeing?  It's difficult to read the code
highlighted, so if you could include a stack trace or other information,
that would be helpful.

Thanks,
Marzia

2008/11/20 ΚΩΣΤΑΣ ΑΝΑΣΤΑΣΙΑΔΗΣ <[EMAIL PROTECTED]>

> Hello everybody from Greece
>
> I want to do this simple task:
> To create an application that will create a datastore and get user input.
> It is like the 1st part of the Guestbook application. Then I want to create
> another application like the 2nd part of the Guestbook application to print
> the user input the 1st part has collected.
> For the 1st part I have created my datastore with greetings as input. It
> worked (1st+2nd part together)
>
> For the 2nd part I use the code:
>
> *#Retrieve using Gql from table the query*
> *class Greeting(db.Model):
>   author = db.UserProperty()
>   content = db.StringProperty(multiline=True)
>   date = db.DateTimeProperty(auto_now_add=True)*
>
> *class MainPage(webapp.RequestHandler):
>   def get(self):
>
>greetings = db.GqlQuery("SELECT * FROM greeting ORDER BY date DESC LIMIT
> 10")
>results=greetings.fetch(10)*
> * #testing output
>  self.response.headers['Content-Type'] = 'text/plain'
>  self.response.out.write('Testing..')
>  self.response.out.write('')
>  for result in results
>   self.response.out.write('content'+result.content)
>
> class Guestbook(webapp.RequestHandler):
>
> def post(self):
>
> greeting = Greeting()*
> *
> if users.get_current_user():
>
> greeting.author = users.get_current_user()*
> *
> greeting.content = self.request.get('content')
>
> greeting.put()
>
> self.redirect('/')*
> **
> **
> *application = webapp.WSGIApplication([
>   ('/', MainPage),
>   ('/sign', Guestbook)
> ], debug=True)*
> **
>
> *def main():
>   run_wsgi_app(application)*
> *if __name__ == "__main__":
>   main()
> *
> The above code is not working. Have any ideas, I would appreciate.
>
> Best Regards,
> COSTAS Anastasiades
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[google-appengine] Re: INPUT-OUTPUT applications using DATASTORE

2008-11-20 Thread ΚΩΣΤΑΣ ΑΝΑΣΤΑΣΙΑΔΗΣ
Hello everybody from Greece
 
I want to do this simple task:
To create an application that will create a datastore and get user input. It is 
like the 1st part of the Guestbook application. Then I want to create another 
application like the 2nd part of the Guestbook application to print the user 
input the 1st part has collected. 
For the 1st part I have created my datastore with greetings as input. It worked 
(1st+2nd part together)
 
For the 2nd part I use the code:
 
#Retrieve using Gql from table the query
class Greeting(db.Model):
  author = db.UserProperty()
  content = db.StringProperty(multiline=True)
  date = db.DateTimeProperty(auto_now_add=True)

class MainPage(webapp.RequestHandler):
  def get(self):
  
   greetings = db.GqlQuery("SELECT * FROM greeting ORDER BY date DESC LIMIT 10")
   results=greetings.fetch(10)
 #testing output
 self.response.headers['Content-Type'] = 'text/plain'
 self.response.out.write('Testing..')
 self.response.out.write('')  
     for result in results
  self.response.out.write('content'+result.content)  
     
class Guestbook(webapp.RequestHandler):
  
def post(self):
    
greeting = Greeting()
    
if users.get_current_user():
  
greeting.author = users.get_current_user()
    
greeting.content = self.request.get('content')
    
greeting.put()
    
self.redirect('/')
 
 
application = webapp.WSGIApplication([
  ('/', MainPage),
  ('/sign', Guestbook)
], debug=True)
 

def main():
  run_wsgi_app(application)
if __name__ == "__main__":
  main()

The above code is not working. Have any ideas, I would appreciate.
 
Best Regards,
COSTAS Anastasiades


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---