[google-appengine] Re: Get Sum from datastore

2009-02-12 Thread Mark Hachey
I can't comment on sharded counter, but just FYI, python has a built in
method called sum that you can apply to lists or tuples, without writing
your own loop.
aList = [1,2,3]
bTup = (1,2,3)

sum(aList) or sum(bList) return 6.

On Wed, Feb 11, 2009 at 7:51 PM, Barry Hunter
barrybhun...@googlemail.comwrote:


 Search the group for 'sharded counter' - the same technique should
 work equally well for calculating a sum.

 On 11/02/2009, Neversummer wrigh...@gmail.com wrote:
 
   I want to get a total (sum) from an property on a given entity. I know
   that sum() is not supported. Is the best method to query for all
   records on the entity in question and work through a loop adding each
   records value (the value of the property in question) to a total
   variable?
 
   It's worth noting that I am brand new to google app engine and to
   python. Thanks for any suggestions.
 
   
 


 --
 Barry

 - www.nearby.org.uk - www.geograph.org.uk -

 


--~--~-~--~~~---~--~~
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 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: How to get the server running

2009-02-06 Thread Mark Hachey
What version of python are you running? If 3.0, it might be a problem with
some commands being obsolete.




On Fri, Feb 6, 2009 at 2:16 PM, andre...@strombacks.se 
andre...@strombacks.se wrote:


 How do you get the server running? I'm trying to do the Hello world
 applicaton described in the Getting started guide and when I'm
 trying to start the webserver with the command: google_appengine/
 dev_appserver.py helloworld/, I only get an error message saying
 Invalid syntax.

 


--~--~-~--~~~---~--~~
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 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: BadValueError: Property fAmount must be a str or unicode instance, not a float

2009-02-03 Thread Mark Hachey
Thank you Alex. That took care of the issue.

On Mon, Feb 2, 2009 at 8:35 PM, Alexander Kojevnikov 
alexan...@kojevnikov.com wrote:


 On Feb 3, 11:11 am, Mark mark.hac...@gmail.com wrote:
  My app is working fine locally on dev_appserver, but I am getting the
  error in the subject line after I do an appcfg update.
 
  The error occurs on a query that happens on the welcome page of the
  app.
 
  I think I uploaded a version that had FloatProperty in one of my
  databases, but I can't remember my exact order of operations that led
  to this error. Now, I've changed my application locally so that that
  field in my database is a StringProperty (I'll deal with the
  floatness of it later) and I get an error after I do appcfg update.
 
 You probably still have entities in the datastore with float property
 values. If you have few of them, go to the Data Viewer and edit the
 values manually. There is an option to change the type of the property
 values.

 If you have a lot of them, you will need to write a data migration
 script, see this article for some pointers:
 http://code.google.com/appengine/articles/update_schema.html

  I also tried using Python 3.0 (I got an error message from the
  appserver that said I can't use FloatProperty with 2.5), but I got an
  error in dev_appserver.py because execfile() is obsolete (is there a
  workaround for this, yet?)
 
 Python 3.0 is not supported by the App Engine, you need to use Python
 2.5. Star this issue if Python 3.0 support is important for you:
 http://code.google.com/p/googleappengine/issues/detail?id=909

 


--~--~-~--~~~---~--~~
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 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---