I think you might need to put brackets at the end of the put.

submission.put()
not
submission.put


On Mar 29, 1:17 pm, Jim Culver <[email protected]> wrote:
> Hey everyone,
>
> I must be doing something stupid, does anyone know why the code below
> does not add a record to the datastore?  The code runs with no errors
> and line logging.debug(submissions.count()) returns 0 and the code
> completes as the log contains the entry for logging.debug("finished").
>
> Any help greatly appreciated.
>
> Thanks
>
> Jim
>
> P.S. I have also checked the dataviewer for any records
>
> import sys
> import logging
> import wsgiref.handlers
> import SQSUrlBuilder
> from google.appengine.api import users
> from google.appengine.ext import webapp
> from google.appengine.api import urlfetch
> from django.utils import simplejson
> from xml.dom import minidom
> from google.appengine.ext import db
>
> class FormSubmission(db.Model):
>          fullname = db.StringProperty()
>          sorter = db.IntegerProperty()
>          time = db.DateTimeProperty(auto_now_add=True)
>
> class pawTest (webapp.RequestHandler):
>         def get(self):
>                 try:
>                         submission = FormSubmission()
>                         submission.fullname = "jim"
>                         submission.sorter = 1
>                         submission.put
>
>                         submissions = db.GqlQuery("SELECT * FROM 
> FormSubmission")
>                         logging.debug(submissions.count())
>         for sub in submissions:
>                                 logging.debug(sub.fullname)
>
>                         #if result.status_code == 200:
>                         json = "{'result': 'OK', 'error': 'null'}"
>                         logging.debug("finished")
>                         #else:
>                          #  json = "{'result': 'Failed', 'error': 'null'}"
>                          #  logging.debug("Error " + result.content)
>                 except:
>                         json = "{'result': 'Failed', 'error': 'null'}"
>                         logging.debug("Error " + sys.exc_info()[0])
>                 finally:
>                         json = self.request.get("callback") + '(' + json + ')'
>                         self.response.headers['Content-Type'] = 
> "application/json"
>                         self.response.headers['Content-Length'] = len(json)
>                         self.response.content_type = "application/json"
>                         self.response.set_status(200)
>                         self.response.out.write(json)
>
> def main():
>         application = webapp.WSGIApplication([('/queuemessage', pawTest)],
> 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