[google-appengine] Re: AppEngine + Eclipse ?= auto complete

2009-05-30 Thread Brandon Watson

Just to add to this:

the line:

import cgi

appears to give me what I need.  When I type "cgi." I get all of the
auto complete.  However, the lines:

from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db

don't give me any auto complete.  If I type "users." there is no auto
complete.

On May 30, 8:44 pm, Brandon  wrote:
> I was doing some beginner AppEngine dev on a Windows box and installed
> Eclipse for that. I liked the autocompletion I got with the objects
> and functions.  Very helpful.
>
> Last night, I moved my dev environment over to my Macbook, and
> installed Eclipse Ganymede. I installed the AppEngine SDK and Eclipse
> plug in. However, when I am typing out code on my Mac, the
> autocomplete isn't functioning. Did I miss a step?  Call me a lazy
> programmer, but having the functions available in that dropdown list
> is missed.
>
> Any help?
--~--~-~--~~~---~--~~
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: ReferenceProperty put() does not update the existing entity

2009-05-30 Thread thebrianschott

Andy,

Whether the identical key_name value results in
writing a new entity that destroys the existing one,
or it only overwrites the altered fields of the
existing old entity, is Ok with me. The result
seems very similar if not identical. So I am
happy with this aspect of my application.

Thanks,

Brian in Atlanta

On May 30, 10:34 pm, Andy Freeman  wrote:
> > "If an instance has been stored before, the put() method updates the
> > existing entity."
>
> As I wrote, Message(handle=handle,owner=person.key())" makes a new
> instance.  It's a constructor - it makes a new instance regardless of
> what the arguments are.  A new instance, by definition, has not been
> stored before.  (No, putting an instance made by calling the
> constructor with the same arguments does not change what db.Model
> subclass constructors do.  Constructors make new instances.  The only
> exception to that rule doesn't apply here.)
>
> If you use key_name and parent, the constructor will make a new
> instance with a specific key.  If there is a stored entity with that
> key, putting said instance will overwrite the previously stored
> entity.
>
> However, that the sentence quoted above does not apply in that
> situation because a new instance is not an instance that has been
> stored before.
>

--~--~-~--~~~---~--~~
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] AppEngine + Eclipse ?= auto complete

2009-05-30 Thread Brandon

I was doing some beginner AppEngine dev on a Windows box and installed
Eclipse for that. I liked the autocompletion I got with the objects
and functions.  Very helpful.

Last night, I moved my dev environment over to my Macbook, and
installed Eclipse Ganymede. I installed the AppEngine SDK and Eclipse
plug in. However, when I am typing out code on my Mac, the
autocomplete isn't functioning. Did I miss a step?  Call me a lazy
programmer, but having the functions available in that dropdown list
is missed.

Any help?
--~--~-~--~~~---~--~~
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: ReferenceProperty put() does not update the existing entity

2009-05-30 Thread Andy Freeman

> "If an instance has been stored before, the put() method updates the
> existing entity."

As I wrote, Message(handle=handle,owner=person.key())" makes a new
instance.  It's a constructor - it makes a new instance regardless of
what the arguments are.  A new instance, by definition, has not been
stored before.  (No, putting an instance made by calling the
constructor with the same arguments does not change what db.Model
subclass constructors do.  Constructors make new instances.  The only
exception to that rule doesn't apply here.)

If you use key_name and parent, the constructor will make a new
instance with a specific key.  If there is a stored entity with that
key, putting said instance will overwrite the previously stored
entity.

However, that the sentence quoted above does not apply in that
situation because a new instance is not an instance that has been
stored before.


On May 29, 8:51 pm, thebrianschott  wrote:
> Andy,
>
> I am basing my approach on the following sentence at the
> following link.
>
> "If an instance has been stored before, the put() method updates the
> existing entity."
>
> http://code.google.com/appengine/docs/python/datastore/creatinggettin...
>
> What am I missing?
>
> Brian in Atlanta
>
> On May 29, 11:27 pm, Andy Freeman  wrote:
>
>
>
> > > > >         message = Message(handle=handle,owner=person.key())
>
> > That line always creates a new Message instance.  Why do you think
> > that it should do anything else?  (The only way to get copies of
> > existing instances is with get() and queries.)- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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] Helloworld "content" does not preserve s

2009-05-30 Thread thebrianschott

Like the Helloworld demo, I want to collect
in the datastore "content" via a textarea html field,
but I don't know how to do so and preserve
the linefeeds in multiline cases. Referring to the
Helloworld example given at the following link,
can you tell me how it could be adapted so that
the linefeeds in the guests' comments are
preserved in the datastore, please?

http://code.google.com/appengine/docs/python/gettingstarted/usingdatastore.html

Brian in Atlanta

--~--~-~--~~~---~--~~
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: Why should I use self.response.out.write?

2009-05-30 Thread Shedokan

Ok thank you very much, I'm going to try different things to see which
will be faster and go with it.

By the way it's for an online os I'm making.

startup is about half a second on google's servers and 90ms on my
computer.

Thanks.

On 30 מאי, 21:30, David Wilson  wrote:
> Correct.. fetching by key_name obviously will only work when you know
> the exactly key you want. :) Otherwise it needs to be a Query.
>
> 2009/5/30 Shedokan :
>
>
>
>
>
>
>
> > Thanks, I didn't think of that probably because I'm new to python.
> > But if I would want to get all files and folders in a path then I woul
> > get them by path and name instead of by key, right?
>
> > On 30 מאי, 15:16, David Wilson  wrote:
> >> 2009/5/29 Shedokan :
>
> >> > TO make things faster I made two Classes:
> >> > this one for the basic file or folder info:
> >> > class Object(db.Model):
> >> >        name = db.StringProperty(multiline=False)
> >> >        path = db.StringProperty(multiline=False)
> >> >        type = db.StringProperty(multiline=False)
> >> >        info = db.StringProperty(multiline=False)
>
> >> >        created = db.DateTimeProperty(auto_now_add=True)
> >> >        changed = db.DateTimeProperty(auto_now_add=True)
>
> >> > and this one for the content of the file:
> >> > class ObjectContent(db.Model):
> >> >        name = db.StringProperty(multiline=False)
> >> >        path = db.StringProperty(multiline=False)
>
> >> >        contents = db.BlobProperty()
>
> >> > That way when I'm getting only the files info i don't have to get all
> >> > of it's content.
> >> > And I am getting files like this:
> >> > db.GqlQuery('SELECT * FROM Object WHERE name= :1 AND path= :
> >> > 2',name,path)
>
> >> This makes use of a composite index when you don't need to. Index
> >> access adds around 100ms extra to each Datastore access (see [0] and
> >> [1] below). Instead of using an index on (path, name), you can use a
> >> key_name composed of the path and name. Something like:
>
> >>     key_name = 'X' + path + name
> >>     object_entity = Object(key_name=key_name, ...)
> >>     content_entity  = ObjectContent(key_name=key_name, contents=contents)
>
> >>     db.put([ object_entity, content_entity ])
>
> >> Then to query:
>
> >>     entity = ObjectContent.get_by_key_name(key_name)
>
> >> Note prefixing the key_name with an 'X', to avoid an error if the path
> >> starts with a number. You should also ensure that no distinct
> >> combination of (path, name) will ever lead to the same key_name. If it
> >> can in your application, separate the path and name with some
> >> character that never appears in a path. This is to prevent ambiguous
> >> key_names from being generated, e.g.:
>
> >>     path, name = '/my/site/', 'foo'
> >>     bad_key_name = '/my/site/foo' <- ambiguous
> >>     better_key_name = '/my/site/|foo'
>
> >>     path, name = '/my/', 'site/foo'
> >>     bad_key_name = '/my/site/foo' <- ambiguous
> >>     better_key_name = '/my/|site/foo'
>
> >> You can save yet more time by fetching the Object and the
> >> ObjectContent simultaneously:
>
> >>     object_entity, content_entity = db.get([
> >>         db.Key.from_path('Object', key_name),
> >>         db.Key.from_path('ObjectContent, key_name)
> >>     ])
>
> >> [0]http://code.google.com/status/appengine/detail/datastore/2009/05/23#a...
> >> [1]http://code.google.com/status/appengine/detail/datastore/2009/05/23#a...
>
> >> > and I list all files in a folder like this:
> >> > db.GqlQuery('SELECT * FROM Object WHERE path= :1',path)
>
> >> > if only I could select parts of the file and not all of the info like
> >> > SQL:
> >> > SELECT name, PATH from ...
>
> >> > On 29 מאי, 17:19, David Wilson  wrote:
> >> >> Hey Shedokan,
>
> >> >> Are you fetching your files from Datastore in a batch, or one at a time?
>
> >> >>    data = []
> >> >>    for filename in ['a', 'b', 'c']:
> >> >>       data.append(SomeModel.get_by_key_name(filename))
>
> >> >> Is significantly slower than:
>
> >> >>    keys = [ db.Key.from_path('SomeModel', fn) for fn in [ 'a', 'b', 'c' 
> >> >> ] ]
> >> >>    data = db.get(keys)
>
> >> >> 2009/5/29 Shedokan :
>
> >> >> > Thanks, I am worried because I am trying to optimize my app to be
> >> >> > almost as fast as the php version.
>
> >> >> > usualy it takes 250ms for an ajax request(firebug) in the php version
> >> >> > and 500ms in the python version so python is two times slower than the
> >> >> > php version.
> >> >> > but I guess it's because I have to store the files in the datastore
> >> >> > and not in real directories.
>
> >> >> > well thanks anyway.
>
> >> >> > On 29 מאי, 04:32, David Wilson  wrote:
> >> >> >> Just assume that any string/list/hash/integer-related operations in
> >> >> >> Python are likely faster than you'll ever need them to be. The
> >> >> >> overhead for buffering the response is going to be tiny regardless of
> >> >> >> your application, since at most you're only talking about handling
> >> >> >> strings of up to 10mb (which is the request size l

[google-appengine] Re: Why should I use self.response.out.write?

2009-05-30 Thread David Wilson

Correct.. fetching by key_name obviously will only work when you know
the exactly key you want. :) Otherwise it needs to be a Query.

2009/5/30 Shedokan :
>
> Thanks, I didn't think of that probably because I'm new to python.
> But if I would want to get all files and folders in a path then I woul
> get them by path and name instead of by key, right?
>
> On 30 מאי, 15:16, David Wilson  wrote:
>> 2009/5/29 Shedokan :
>>
>>
>>
>>
>>
>> > TO make things faster I made two Classes:
>> > this one for the basic file or folder info:
>> > class Object(db.Model):
>> >        name = db.StringProperty(multiline=False)
>> >        path = db.StringProperty(multiline=False)
>> >        type = db.StringProperty(multiline=False)
>> >        info = db.StringProperty(multiline=False)
>>
>> >        created = db.DateTimeProperty(auto_now_add=True)
>> >        changed = db.DateTimeProperty(auto_now_add=True)
>>
>> > and this one for the content of the file:
>> > class ObjectContent(db.Model):
>> >        name = db.StringProperty(multiline=False)
>> >        path = db.StringProperty(multiline=False)
>>
>> >        contents = db.BlobProperty()
>>
>> > That way when I'm getting only the files info i don't have to get all
>> > of it's content.
>> > And I am getting files like this:
>> > db.GqlQuery('SELECT * FROM Object WHERE name= :1 AND path= :
>> > 2',name,path)
>>
>> This makes use of a composite index when you don't need to. Index
>> access adds around 100ms extra to each Datastore access (see [0] and
>> [1] below). Instead of using an index on (path, name), you can use a
>> key_name composed of the path and name. Something like:
>>
>>     key_name = 'X' + path + name
>>     object_entity = Object(key_name=key_name, ...)
>>     content_entity  = ObjectContent(key_name=key_name, contents=contents)
>>
>>     db.put([ object_entity, content_entity ])
>>
>> Then to query:
>>
>>     entity = ObjectContent.get_by_key_name(key_name)
>>
>> Note prefixing the key_name with an 'X', to avoid an error if the path
>> starts with a number. You should also ensure that no distinct
>> combination of (path, name) will ever lead to the same key_name. If it
>> can in your application, separate the path and name with some
>> character that never appears in a path. This is to prevent ambiguous
>> key_names from being generated, e.g.:
>>
>>     path, name = '/my/site/', 'foo'
>>     bad_key_name = '/my/site/foo' <- ambiguous
>>     better_key_name = '/my/site/|foo'
>>
>>     path, name = '/my/', 'site/foo'
>>     bad_key_name = '/my/site/foo' <- ambiguous
>>     better_key_name = '/my/|site/foo'
>>
>> You can save yet more time by fetching the Object and the
>> ObjectContent simultaneously:
>>
>>     object_entity, content_entity = db.get([
>>         db.Key.from_path('Object', key_name),
>>         db.Key.from_path('ObjectContent, key_name)
>>     ])
>>
>> [0]http://code.google.com/status/appengine/detail/datastore/2009/05/23#a...
>> [1]http://code.google.com/status/appengine/detail/datastore/2009/05/23#a...
>>
>>
>>
>>
>>
>> > and I list all files in a folder like this:
>> > db.GqlQuery('SELECT * FROM Object WHERE path= :1',path)
>>
>> > if only I could select parts of the file and not all of the info like
>> > SQL:
>> > SELECT name, PATH from ...
>>
>> > On 29 מאי, 17:19, David Wilson  wrote:
>> >> Hey Shedokan,
>>
>> >> Are you fetching your files from Datastore in a batch, or one at a time?
>>
>> >>    data = []
>> >>    for filename in ['a', 'b', 'c']:
>> >>       data.append(SomeModel.get_by_key_name(filename))
>>
>> >> Is significantly slower than:
>>
>> >>    keys = [ db.Key.from_path('SomeModel', fn) for fn in [ 'a', 'b', 'c' ] 
>> >> ]
>> >>    data = db.get(keys)
>>
>> >> 2009/5/29 Shedokan :
>>
>> >> > Thanks, I am worried because I am trying to optimize my app to be
>> >> > almost as fast as the php version.
>>
>> >> > usualy it takes 250ms for an ajax request(firebug) in the php version
>> >> > and 500ms in the python version so python is two times slower than the
>> >> > php version.
>> >> > but I guess it's because I have to store the files in the datastore
>> >> > and not in real directories.
>>
>> >> > well thanks anyway.
>>
>> >> > On 29 מאי, 04:32, David Wilson  wrote:
>> >> >> Just assume that any string/list/hash/integer-related operations in
>> >> >> Python are likely faster than you'll ever need them to be. The
>> >> >> overhead for buffering the response is going to be tiny regardless of
>> >> >> your application, since at most you're only talking about handling
>> >> >> strings of up to 10mb (which is the request size limit).
>>
>> >> >> If there is anything with AppEngine you need to be careful of, it is
>> >> >> use of Datastore, where reading/writing large numbers of entities will
>> >> >> cost a lot of performance. Reducing your Datastore use by a single
>> >> >> db.get() is equal to thousands of calls to self.response.out.write()
>>
>> >> >> $ python /usr/lib/python2.5/timeit.py -v -s 'from cStringIO import
>> >> >>

[google-appengine] Re: Why should I use self.response.out.write?

2009-05-30 Thread Shedokan

Thanks, I didn't think of that probably because I'm new to python.
But if I would want to get all files and folders in a path then I woul
get them by path and name instead of by key, right?

On 30 מאי, 15:16, David Wilson  wrote:
> 2009/5/29 Shedokan :
>
>
>
>
>
> > TO make things faster I made two Classes:
> > this one for the basic file or folder info:
> > class Object(db.Model):
> >        name = db.StringProperty(multiline=False)
> >        path = db.StringProperty(multiline=False)
> >        type = db.StringProperty(multiline=False)
> >        info = db.StringProperty(multiline=False)
>
> >        created = db.DateTimeProperty(auto_now_add=True)
> >        changed = db.DateTimeProperty(auto_now_add=True)
>
> > and this one for the content of the file:
> > class ObjectContent(db.Model):
> >        name = db.StringProperty(multiline=False)
> >        path = db.StringProperty(multiline=False)
>
> >        contents = db.BlobProperty()
>
> > That way when I'm getting only the files info i don't have to get all
> > of it's content.
> > And I am getting files like this:
> > db.GqlQuery('SELECT * FROM Object WHERE name= :1 AND path= :
> > 2',name,path)
>
> This makes use of a composite index when you don't need to. Index
> access adds around 100ms extra to each Datastore access (see [0] and
> [1] below). Instead of using an index on (path, name), you can use a
> key_name composed of the path and name. Something like:
>
>     key_name = 'X' + path + name
>     object_entity = Object(key_name=key_name, ...)
>     content_entity  = ObjectContent(key_name=key_name, contents=contents)
>
>     db.put([ object_entity, content_entity ])
>
> Then to query:
>
>     entity = ObjectContent.get_by_key_name(key_name)
>
> Note prefixing the key_name with an 'X', to avoid an error if the path
> starts with a number. You should also ensure that no distinct
> combination of (path, name) will ever lead to the same key_name. If it
> can in your application, separate the path and name with some
> character that never appears in a path. This is to prevent ambiguous
> key_names from being generated, e.g.:
>
>     path, name = '/my/site/', 'foo'
>     bad_key_name = '/my/site/foo' <- ambiguous
>     better_key_name = '/my/site/|foo'
>
>     path, name = '/my/', 'site/foo'
>     bad_key_name = '/my/site/foo' <- ambiguous
>     better_key_name = '/my/|site/foo'
>
> You can save yet more time by fetching the Object and the
> ObjectContent simultaneously:
>
>     object_entity, content_entity = db.get([
>         db.Key.from_path('Object', key_name),
>         db.Key.from_path('ObjectContent, key_name)
>     ])
>
> [0]http://code.google.com/status/appengine/detail/datastore/2009/05/23#a...
> [1]http://code.google.com/status/appengine/detail/datastore/2009/05/23#a...
>
>
>
>
>
> > and I list all files in a folder like this:
> > db.GqlQuery('SELECT * FROM Object WHERE path= :1',path)
>
> > if only I could select parts of the file and not all of the info like
> > SQL:
> > SELECT name, PATH from ...
>
> > On 29 מאי, 17:19, David Wilson  wrote:
> >> Hey Shedokan,
>
> >> Are you fetching your files from Datastore in a batch, or one at a time?
>
> >>    data = []
> >>    for filename in ['a', 'b', 'c']:
> >>       data.append(SomeModel.get_by_key_name(filename))
>
> >> Is significantly slower than:
>
> >>    keys = [ db.Key.from_path('SomeModel', fn) for fn in [ 'a', 'b', 'c' ] ]
> >>    data = db.get(keys)
>
> >> 2009/5/29 Shedokan :
>
> >> > Thanks, I am worried because I am trying to optimize my app to be
> >> > almost as fast as the php version.
>
> >> > usualy it takes 250ms for an ajax request(firebug) in the php version
> >> > and 500ms in the python version so python is two times slower than the
> >> > php version.
> >> > but I guess it's because I have to store the files in the datastore
> >> > and not in real directories.
>
> >> > well thanks anyway.
>
> >> > On 29 מאי, 04:32, David Wilson  wrote:
> >> >> Just assume that any string/list/hash/integer-related operations in
> >> >> Python are likely faster than you'll ever need them to be. The
> >> >> overhead for buffering the response is going to be tiny regardless of
> >> >> your application, since at most you're only talking about handling
> >> >> strings of up to 10mb (which is the request size limit).
>
> >> >> If there is anything with AppEngine you need to be careful of, it is
> >> >> use of Datastore, where reading/writing large numbers of entities will
> >> >> cost a lot of performance. Reducing your Datastore use by a single
> >> >> db.get() is equal to thousands of calls to self.response.out.write()
>
> >> >> $ python /usr/lib/python2.5/timeit.py -v -s 'from cStringIO import
> >> >> StringIO; out = StringIO()'  'out.write("123")'
> >> >> 1 loops -> 0.00373 secs
> >> >> 10 loops -> 0.0383 secs
> >> >> 100 loops -> 0.365 secs
> >> >> raw times: 0.358 0.358 0.357
> >> >> 100 loops, best of 3: 0.357 usec per loop
>
> >> >> $ ae
> >> >> Python 2.5.1 (r251:54863,

[google-appengine] Google Login Redirect back to page after user registers.

2009-05-30 Thread Ray Malone

else:
  self.redirect(users.create_login_url(self.request.uri))

If the user has not signed in, tell webapp to redirect the user's
browser to the Google account sign-in screen. The redirect includes
the URL to this page (self.request.uri) so the Google account sign-in
mechanism will send the user back here after the user has signed in or
registered for a new account.

this doesn't seem to work.  If the user registers they have to
validate their new id and doesn't send the user back to the page.
It's makes for a odd way to register new users.  Any way to do this so
the validation email or the validation page will actually send the
user back to your site.
--~--~-~--~~~---~--~~
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: encode textProperty into email body

2009-05-30 Thread thebrianschott

I have narrowed down the sendmail problem a little.
Below is my Mac OS X terminal console session
and I would appreciate learning how to add the
--enable_sendmail  command line argument.

***console session below***

[12:14pm brian~]% cd /Users/brian/googleapps/howsmy/
[12:15pm brian~/googleapps/howsmy]% dev_appserver.py --enable_sendmail
howsmy
tcsh: dev_appserver.py: Command not found.
[12:15pm brian~/googleapps/howsmy]% sudo locate dev_appserver.py
Password:
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
dev_appserver.py
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/dev_appserver.py
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/dev_appserver.pyc
[12:16pm brian~/googleapps/howsmy]% cd
[12:16pm brian~]% /Applications/GoogleAppEngineLauncher.app/Contents/
Resources/GoogleAppEngine-default.bundle/Contents/Resources/
google_appengine/dev_appserver.py --enable_sendmail howsmy
ERROR:root:Application configuration file not found in howsmy
[12:17pm brian~]% cd /Users/brian/googleapps/howsmy/[12:18pm brian~/
googleapps/howsmy]% /Applications/GoogleAppEngineLauncher.app/Contents/
Resources/GoogleAppEngine-default.bundle/Contents/Resources/
google_appengine/dev_appserver.py --enable_sendmail howsmy
ERROR:root:Application configuration file not found in howsmy
[12:18pm brian~/googleapps/howsmy]% sudo locate sendmailPassword:/
System/Library/Perl/Extras/5.8.6/Mail/Mailer/sendmail.pm
/usr/lib/php/Mail/sendmail.php
/usr/sbin/sendmail
/usr/share/emacs/21.2/lisp/mail/sendmail.el
/usr/share/emacs/21.2/lisp/mail/sendmail.elc
/usr/share/man/man1/sendmail.1


Brian in Atlanta
--~--~-~--~~~---~--~~
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: encode textProperty into email body

2009-05-30 Thread thebrianschott

Keakon,

Another mistake on my part. I am sorry.
"self.response.out.write(body)" DOES produce output, but I
did not see it because it was not the last output (I guess).

Anyhow, I was able to get some output from your .encode('utf')
or by using this code: message.comment = str(comment)
and using str() around all my strings.

So thanks very much for your great help.

However, 1 new problems has clarified itself. I am getting
the following INFO message which I do not know how to
implement, but am trying.

INFO 2009-05-30 16:01:14,392 mail_stub.py] You are not currently
sending out real email.  If you have sendmail installed you can use it
by using the server with --enable_sendmail

Brian in Atlanta


--~--~-~--~~~---~--~~
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: encode textProperty into email body

2009-05-30 Thread 风笑雪
So the body is a tuple, not a string.
You can try this:

self.response.out.write(len(body)) # I think you'll get 0 since you have an
'not all arguments converted during string formatting' error
self.response.out.write(' '.join(body))

Maybe you need check the value you get.


2009/5/30 thebrianschott 

>
> Keakon,
>
> I have 2 answers here.
>
> 1.
> "self.response.out.write(body)" produced no output.
> Btw, the input to body is an html form "textarea" .
>
> 2.
> I made a mistake. Your suggestion to use .encode('utf8')
> did produce a slight improvement in the Log Console. I
> got the following extra lines and did not notice them
> until just now. So the utf8 encode did allow the
> MailService.Send to begin, when it had not previously.
>
> extra Log Console info below *
>
> INFO 2009-05-30 14:32:15,906 mail_stub.py] MailService.Send
> INFO 2009-05-30 14:32:15,971 mail_stub.py]   From:
> t...@example.com
> INFO 2009-05-30 14:32:15,972 mail_stub.py]   To: t...@example.com
> INFO 2009-05-30 14:32:15,973 mail_stub.py]   Subject: How's my
> dancing?
> INFO 2009-05-30 14:32:15,974 mail_stub.py]   Body:
> INFO 2009-05-30 14:32:15,974 mail_stub.py] Content-type: text/
> plain
> INFO 2009-05-30 14:32:15,975 mail_stub.py] Data length: 4
> ERROR2009-05-30 14:32:16,140 __init__.py] 'tuple' object has no
> attribute 'encode'
>
>
>
>
> On May 30, 9:42 am, 风笑雪  wrote:
> > The error is so strange.Can you just output it without any conversion?
> >
> > self.response.out.write(body)
> >
> > 2009/5/30 thebrianschott 
> >
> >
> >
> > > 风笑雪,
> >
> > > Thanks.
> >
> > > That .encode does not fix my problem, unfortunately.
> > > When I try to do a logging.info I get the following error
> > > as I did for plain body.
> >
> > > Do you have any different ideas, please?
> >
> > > logging.info("SendMessage body %s " % body)
> >
> > > *error produced below***
> >
> > > Traceback (most recent call last):
> > >  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
> > > GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
> > > google/appengine/ext/webapp/__init__.py", line 500, in __call__
> > >handler.post(*groups)
> > >   File "/Users/brian/googleapps/howsmy/main.py", line 213, in post
> > > logging.info("SendMessage body %s " % body)
> > > TypeError: not all arguments converted during string formatting
> >
> > > On May 30, 3:48 am, 风笑雪  wrote:
> > > > You can try to encode it:
> > > > body = message.comment.encode('utf8')
> >
> > > > 2009/5/30 thebrianschott 
> >
>

--~--~-~--~~~---~--~~
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: encode textProperty into email body

2009-05-30 Thread thebrianschott

Keakon,

I have 2 answers here.

1.
"self.response.out.write(body)" produced no output.
Btw, the input to body is an html form "textarea" .

2.
I made a mistake. Your suggestion to use .encode('utf8')
did produce a slight improvement in the Log Console. I
got the following extra lines and did not notice them
until just now. So the utf8 encode did allow the
MailService.Send to begin, when it had not previously.

extra Log Console info below *

INFO 2009-05-30 14:32:15,906 mail_stub.py] MailService.Send
INFO 2009-05-30 14:32:15,971 mail_stub.py]   From:
t...@example.com
INFO 2009-05-30 14:32:15,972 mail_stub.py]   To: t...@example.com
INFO 2009-05-30 14:32:15,973 mail_stub.py]   Subject: How's my
dancing?
INFO 2009-05-30 14:32:15,974 mail_stub.py]   Body:
INFO 2009-05-30 14:32:15,974 mail_stub.py] Content-type: text/
plain
INFO 2009-05-30 14:32:15,975 mail_stub.py] Data length: 4
ERROR2009-05-30 14:32:16,140 __init__.py] 'tuple' object has no
attribute 'encode'




On May 30, 9:42 am, 风笑雪  wrote:
> The error is so strange.Can you just output it without any conversion?
>
> self.response.out.write(body)
>
> 2009/5/30 thebrianschott 
>
>
>
> > 风笑雪,
>
> > Thanks.
>
> > That .encode does not fix my problem, unfortunately.
> > When I try to do a logging.info I get the following error
> > as I did for plain body.
>
> > Do you have any different ideas, please?
>
> > logging.info("SendMessage body %s " % body)
>
> > *error produced below***
>
> > Traceback (most recent call last):
> >  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
> > GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
> > google/appengine/ext/webapp/__init__.py", line 500, in __call__
> >handler.post(*groups)
> >   File "/Users/brian/googleapps/howsmy/main.py", line 213, in post
> > logging.info("SendMessage body %s " % body)
> > TypeError: not all arguments converted during string formatting
>
> > On May 30, 3:48 am, 风笑雪  wrote:
> > > You can try to encode it:
> > > body = message.comment.encode('utf8')
>
> > > 2009/5/30 thebrianschott 
--~--~-~--~~~---~--~~
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] How to use get_request_cpu_usage?

2009-05-30 Thread 秦锋

Introduction on this api is so simple for me and I don't know how to
check if this number exceeded top line?
--~--~-~--~~~---~--~~
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: encode textProperty into email body

2009-05-30 Thread 风笑雪
The error is so strange.Can you just output it without any conversion?

self.response.out.write(body)

2009/5/30 thebrianschott 

>
> 风笑雪,
>
> Thanks.
>
> That .encode does not fix my problem, unfortunately.
> When I try to do a logging.info I get the following error
> as I did for plain body.
>
> Do you have any different ideas, please?
>
> logging.info("SendMessage body %s " % body)
>
> *error produced below***
>
> Traceback (most recent call last):
>  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
> GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
> google/appengine/ext/webapp/__init__.py", line 500, in __call__
>handler.post(*groups)
>   File "/Users/brian/googleapps/howsmy/main.py", line 213, in post
> logging.info("SendMessage body %s " % body)
> TypeError: not all arguments converted during string formatting
>
> On May 30, 3:48 am, 风笑雪  wrote:
> > You can try to encode it:
> > body = message.comment.encode('utf8')
> >
> > 2009/5/30 thebrianschott 
> >
> >
> >
>
> >
>

--~--~-~--~~~---~--~~
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: encode textProperty into email body

2009-05-30 Thread thebrianschott

风笑雪,

Thanks.

That .encode does not fix my problem, unfortunately.
When I try to do a logging.info I get the following error
as I did for plain body.

Do you have any different ideas, please?

logging.info("SendMessage body %s " % body)

*error produced below***

Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/ext/webapp/__init__.py", line 500, in __call__
handler.post(*groups)
  File "/Users/brian/googleapps/howsmy/main.py", line 213, in post
logging.info("SendMessage body %s " % body)
TypeError: not all arguments converted during string formatting

On May 30, 3:48 am, 风笑雪  wrote:
> You can try to encode it:
> body = message.comment.encode('utf8')
>
> 2009/5/30 thebrianschott 
>
>
>

--~--~-~--~~~---~--~~
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: Cron Job's and ReferenceProperty and KindError in django on appengine

2009-05-30 Thread Waldemar Kornewald

Hi,
if you're using app-engine-patch just import
common.appenginepatch.main at the top of your cron script, so Django/
GAE is initialized correctly.

Bye,
Waldemar Kornewald
--~--~-~--~~~---~--~~
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: Why should I use self.response.out.write?

2009-05-30 Thread David Wilson

2009/5/29 Shedokan :
>
> TO make things faster I made two Classes:
> this one for the basic file or folder info:
> class Object(db.Model):
>        name = db.StringProperty(multiline=False)
>        path = db.StringProperty(multiline=False)
>        type = db.StringProperty(multiline=False)
>        info = db.StringProperty(multiline=False)
>
>        created = db.DateTimeProperty(auto_now_add=True)
>        changed = db.DateTimeProperty(auto_now_add=True)
>
>
> and this one for the content of the file:
> class ObjectContent(db.Model):
>        name = db.StringProperty(multiline=False)
>        path = db.StringProperty(multiline=False)
>
>        contents = db.BlobProperty()
>
> That way when I'm getting only the files info i don't have to get all
> of it's content.
> And I am getting files like this:
> db.GqlQuery('SELECT * FROM Object WHERE name= :1 AND path= :
> 2',name,path)

This makes use of a composite index when you don't need to. Index
access adds around 100ms extra to each Datastore access (see [0] and
[1] below). Instead of using an index on (path, name), you can use a
key_name composed of the path and name. Something like:

key_name = 'X' + path + name
object_entity = Object(key_name=key_name, ...)
content_entity  = ObjectContent(key_name=key_name, contents=contents)

db.put([ object_entity, content_entity ])

Then to query:

entity = ObjectContent.get_by_key_name(key_name)

Note prefixing the key_name with an 'X', to avoid an error if the path
starts with a number. You should also ensure that no distinct
combination of (path, name) will ever lead to the same key_name. If it
can in your application, separate the path and name with some
character that never appears in a path. This is to prevent ambiguous
key_names from being generated, e.g.:

path, name = '/my/site/', 'foo'
bad_key_name = '/my/site/foo' <- ambiguous
better_key_name = '/my/site/|foo'

path, name = '/my/', 'site/foo'
bad_key_name = '/my/site/foo' <- ambiguous
better_key_name = '/my/|site/foo'

You can save yet more time by fetching the Object and the
ObjectContent simultaneously:

object_entity, content_entity = db.get([
db.Key.from_path('Object', key_name),
db.Key.from_path('ObjectContent, key_name)
])


[0] 
http://code.google.com/status/appengine/detail/datastore/2009/05/23#ae-trust-detail-datastore-get-latency
[1] 
http://code.google.com/status/appengine/detail/datastore/2009/05/23#ae-trust-detail-datastore-query-latency


>
> and I list all files in a folder like this:
> db.GqlQuery('SELECT * FROM Object WHERE path= :1',path)
>
> if only I could select parts of the file and not all of the info like
> SQL:
> SELECT name, PATH from ...
>
>
> On 29 מאי, 17:19, David Wilson  wrote:
>> Hey Shedokan,
>>
>> Are you fetching your files from Datastore in a batch, or one at a time?
>>
>>    data = []
>>    for filename in ['a', 'b', 'c']:
>>       data.append(SomeModel.get_by_key_name(filename))
>>
>> Is significantly slower than:
>>
>>    keys = [ db.Key.from_path('SomeModel', fn) for fn in [ 'a', 'b', 'c' ] ]
>>    data = db.get(keys)
>>
>> 2009/5/29 Shedokan :
>>
>>
>>
>>
>>
>> > Thanks, I am worried because I am trying to optimize my app to be
>> > almost as fast as the php version.
>>
>> > usualy it takes 250ms for an ajax request(firebug) in the php version
>> > and 500ms in the python version so python is two times slower than the
>> > php version.
>> > but I guess it's because I have to store the files in the datastore
>> > and not in real directories.
>>
>> > well thanks anyway.
>>
>> > On 29 מאי, 04:32, David Wilson  wrote:
>> >> Just assume that any string/list/hash/integer-related operations in
>> >> Python are likely faster than you'll ever need them to be. The
>> >> overhead for buffering the response is going to be tiny regardless of
>> >> your application, since at most you're only talking about handling
>> >> strings of up to 10mb (which is the request size limit).
>>
>> >> If there is anything with AppEngine you need to be careful of, it is
>> >> use of Datastore, where reading/writing large numbers of entities will
>> >> cost a lot of performance. Reducing your Datastore use by a single
>> >> db.get() is equal to thousands of calls to self.response.out.write()
>>
>> >> $ python /usr/lib/python2.5/timeit.py -v -s 'from cStringIO import
>> >> StringIO; out = StringIO()'  'out.write("123")'
>> >> 1 loops -> 0.00373 secs
>> >> 10 loops -> 0.0383 secs
>> >> 100 loops -> 0.365 secs
>> >> raw times: 0.358 0.358 0.357
>> >> 100 loops, best of 3: 0.357 usec per loop
>>
>> >> $ ae
>> >> Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12)
>> >> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
>> >> Type "help", "copyright", "credits" or "license" for more information.
>> >> (AppEngineShell)>>> import time
>> >> >>> t1 = time.time() ; db.get(db.Key.from_path('Foo', 1234)) ; print 
>> >> >>> (time.time()-t1)*1000
>>
>> >> 12.839233
>>
>> >> David.

[google-appengine] Re: Cron Job's and ReferenceProperty and KindError in django on appengine

2009-05-30 Thread Ian Lewis
Sorry, I meant roderic,

2009/5/30 Ian Lewis 

> Nick,
>
> Are you using something like appengine-patch or appengine_django to write
> your application?
>
>
> On Sat, May 30, 2009 at 3:49 AM, Nick Johnson (Google) <
> nick.john...@google.com> wrote:
>
>>
>> Hi roderic,
>>
>> You can't use a an App Engine datastore ReferenceProperty to refer to
>> a Django model instance.
>>
>> -Nick Johnson
>>
>> On Wed, May 27, 2009 at 12:51 PM, roderic  wrote:
>> >
>> > Hello,
>> > The problem that I'm having is that my cron job seems to break on the
>> > import of my models. The traceback looks like this:
>> >
>> > : reference_class must be
>> > Model or _SELF_REFERENCE
>> > Traceback (most recent call last):
>> >  File "/base/data/home/apps/rcapp01/1.333786861669922384/cron.py",
>> > line 1, in 
>> >from callme.models import CAction
>> >  File "/base/data/home/apps/rcapp01/1.333786861669922384/callme/
>> > models.py", line 9, in 
>> >class CUser(db.Model):
>> >  File "/base/data/home/apps/rcapp01/1.333786861669922384/callme/
>> > models.py", line 11, in CUser
>> >user = db.ReferenceProperty(User)
>> >  File "/base/python_lib/versions/1/google/appengine/ext/db/
>> > __init__.py", line 2577, in __init__
>> >raise KindError('reference_class must be Model or
>> > _SELF_REFERENCE')
>> >
>> > The code in question deals with the ReferenceProperty that I am using
>> > to extend the basic django user. The code for that looks like this:
>> >
>> > from google.appengine.ext import db
>> > from django.contrib.auth.models import User
>> >
>> > # Create your models here.
>> > class CUser(db.Model):
>> >user = db.ReferenceProperty(User)
>> >
>> > I don't seem to have much problem interacting with the profile through
>> > the web requests, but when the cron job tries to run it blows up. I am
>> > not going to include the cron job as you can see that the traceback
>> > happens on the import.
>> >
>> > Any thoughts on this? Why would the cron job be blowing up on import?
>> > Have I set something up wrong? The development environment doesn't
>> > seem to blow up when this happens.
>> >
>> > Thanks in advance.
>> >
>> > >
>>
>> >>
>>
>
>
> --
> ===
> 株式会社ビープラウド  イアン・ルイス
> 〒150-0012
> 東京都渋谷区広尾1-11-2アイオス広尾ビル604
> email: ianmle...@beproud.jp
> TEL:03-5795-2707
> FAX:03-5795-2708
> http://www.beproud.jp/
> ===
>



-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

--~--~-~--~~~---~--~~
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: Cron Job's and ReferenceProperty and KindError in django on appengine

2009-05-30 Thread Ian Lewis
Nick,

Are you using something like appengine-patch or appengine_django to write
your application?

On Sat, May 30, 2009 at 3:49 AM, Nick Johnson (Google) <
nick.john...@google.com> wrote:

>
> Hi roderic,
>
> You can't use a an App Engine datastore ReferenceProperty to refer to
> a Django model instance.
>
> -Nick Johnson
>
> On Wed, May 27, 2009 at 12:51 PM, roderic  wrote:
> >
> > Hello,
> > The problem that I'm having is that my cron job seems to break on the
> > import of my models. The traceback looks like this:
> >
> > : reference_class must be
> > Model or _SELF_REFERENCE
> > Traceback (most recent call last):
> >  File "/base/data/home/apps/rcapp01/1.333786861669922384/cron.py",
> > line 1, in 
> >from callme.models import CAction
> >  File "/base/data/home/apps/rcapp01/1.333786861669922384/callme/
> > models.py", line 9, in 
> >class CUser(db.Model):
> >  File "/base/data/home/apps/rcapp01/1.333786861669922384/callme/
> > models.py", line 11, in CUser
> >user = db.ReferenceProperty(User)
> >  File "/base/python_lib/versions/1/google/appengine/ext/db/
> > __init__.py", line 2577, in __init__
> >raise KindError('reference_class must be Model or
> > _SELF_REFERENCE')
> >
> > The code in question deals with the ReferenceProperty that I am using
> > to extend the basic django user. The code for that looks like this:
> >
> > from google.appengine.ext import db
> > from django.contrib.auth.models import User
> >
> > # Create your models here.
> > class CUser(db.Model):
> >user = db.ReferenceProperty(User)
> >
> > I don't seem to have much problem interacting with the profile through
> > the web requests, but when the cron job tries to run it blows up. I am
> > not going to include the cron job as you can see that the traceback
> > happens on the import.
> >
> > Any thoughts on this? Why would the cron job be blowing up on import?
> > Have I set something up wrong? The development environment doesn't
> > seem to blow up when this happens.
> >
> > Thanks in advance.
> >
> > >
>
> >
>


-- 
===
株式会社ビープラウド  イアン・ルイス
〒150-0012
東京都渋谷区広尾1-11-2アイオス広尾ビル604
email: ianmle...@beproud.jp
TEL:03-5795-2707
FAX:03-5795-2708
http://www.beproud.jp/
===

--~--~-~--~~~---~--~~
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: encode textProperty into email body

2009-05-30 Thread 风笑雪
You can try to encode it:
body = message.comment.encode('utf8')

2009/5/30 thebrianschott 

>
> I am getting an encode error from the snippet
> of code below. The error is referring to the
> very last line of the code snippet below.
>
> How can I fix it, please?
>
> Thanks,
>
> Brian in Atlanta
>
> **error message below
>  File "/Users/brian/googleapps/howsmy/main.py", line 213, in post
>mail.send_mail(sender_address, user_address, subject, body)
>
> **code excerpt below*
>
> from google.appengine.api import mail
>
> class Message(db.Model):
>comment = db.TextProperty()
>
> class SendMessage(webapp.RequestHandler):
>def post(self):
>comment = self.request.get('comment')
>user_address = y...@gmail.com
>sender_address = m...@gmail.com
>subject = "Hi"
>message = Message(key_name="me")
>message.comment = comment
>body = message.comment
>mail.send_mail(sender_address, user_address, subject, body)
>
>
> >
>

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