[google-appengine] Re: Path from Key

2009-05-26 Thread David Wilson

Hey Colin,

I've been using this:

def key_to_path(model):
key = model.key()
output = []

while key:
name = key.name()
if name is None:
output.append(key.id())
else:
output.append(name)

output.append(key.kind())
key = key.parent()

output.reverse()
return output


2009/5/26 Nick Johnson (Google) :
>
> Hi Colin,
>
> You're correct - there's currently no built-in method to do this, and
> recursively (or iteratively, with a stack) calling key.parent() is
> your best option.
>
> -Nick Johnson
>
> On Mon, May 25, 2009 at 3:17 AM, hawkett  wrote:
>>
>> Hi,
>>
>>   There is a method Key.from_path() - which lets you supply the path
>> to construct the key.  Is there a way to retrieve the path from a key
>> object? i.e. Key.path()?  If not, is there a way to determine the path
>> from the key?  Is recursively calling Key.parent() until you get
>> 'None' the only way to do this?  It would be nice to make a single
>> call to get a list of the keys to the parent.
>>
>>   Thanks,
>>
>> Colin
>>
>
> >
>



-- 
It is better to be wrong than to be vague.
  — Freeman Dyson

--~--~-~--~~~---~--~~
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: Path from Key

2009-05-26 Thread Nick Johnson (Google)

Hi Colin,

You're correct - there's currently no built-in method to do this, and
recursively (or iteratively, with a stack) calling key.parent() is
your best option.

-Nick Johnson

On Mon, May 25, 2009 at 3:17 AM, hawkett  wrote:
>
> Hi,
>
>   There is a method Key.from_path() - which lets you supply the path
> to construct the key.  Is there a way to retrieve the path from a key
> object? i.e. Key.path()?  If not, is there a way to determine the path
> from the key?  Is recursively calling Key.parent() until you get
> 'None' the only way to do this?  It would be nice to make a single
> call to get a list of the keys to the parent.
>
>   Thanks,
>
> Colin
> 

--~--~-~--~~~---~--~~
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: Path from Key

2009-05-26 Thread Roshni Basu
Hi ,

I'm trying to deploy an application through eclipse. I have used my gmail id
only . It gives me the following error.
java.io.IOException: Error posting to URL:
http://appengine.google.com/api/appversion/create?app_id=roshni-basu&version=1&;
400 Bad Request
Invalid runtime or the current user is not authorized to use it.
I did not get any mail saying i have been registered also.
How do I solve this issue??

Regards
Roshni

On Mon, May 25, 2009 at 3:47 PM, hawkett  wrote:

>
> Hi,
>
>   There is a method Key.from_path() - which lets you supply the path
> to construct the key.  Is there a way to retrieve the path from a key
> object? i.e. Key.path()?  If not, is there a way to determine the path
> from the key?  Is recursively calling Key.parent() until you get
> 'None' the only way to do this?  It would be nice to make a single
> call to get a list of the keys to the parent.
>
>   Thanks,
>
> Colin
> >
>

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