Sure.   Full details are on 
http://code.google.com/appengine/docs/python/datastore/modelclass.html

hit on /confirm/account/(?P<account>.*)$

        key_name = 'account:' + account
        acc = Account.get_by_key_name(key_name)
        if not acc:
            template_values = {'account' : account}
            template_file = os.path.join(os.path.dirname(__file__),
'templates', 'NoAccount.html')
            body = template.render(template_file, template_values)
            self.response.out.write(body)
            logging.warning( account + " not found" )
            return False

This is trivial and user confirmations (and all the stuff that comes
with having good passwords, forgetting passwords, changing emails,
etc.) is probably best done with other tools.

Where it starts to matter a lot on GAE is where it's something like an
URL or email or phone number or part number.   These are (or can be)
things that have one entry or no entry.   For something like Reddish,
it might be Url.get_by_key_name('url:http://www.web2py.com/article')
to see if the article can be entered.

Url.get_or_insert('url:http://www.web2py.com/article') means "get this
key_name if it exists, otherwise create it"   If you have a clear
naming scheme, it makes it easy to use an item that might not have
existed until just now.   Example might be tracking Twitter
usernames.   We don't know if we saw /jdeibele or /web2py  before but
now he's referencing /web2py so we'd get_or_insert('user:web2py') and
add a ReferenceProperty to get_or_insert('user:jdeibele')



On Aug 5, 1:53 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I am not sure what it does. Can you give us an example?
>
> Massimo
>
> On Aug 5, 12:44 pm, Jim <jdeib...@gmail.com> wrote:
>
> > I was (and am) very interested in web2py but I want to use GAE for
> > hosting.   One of the things that web2py didn't have was support for
> > model.get_by_key_name
>
> > Where it's possible to have a defined key_name - say an email address
> > or a domain - it requires significantly less quota to get than to
> > query.   As in 10-20%.
>
> > I try to follow the web2py messages but haven't seen anything on this
> > lately.  I know a couple of people were modifying web2py for their own
> > use to get the benefits of this.
>
> > Is this something that web2py will support in the future?
>
> > Thanks!
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to