2009/12/29 G <culturea...@gmail.com>:
> A previous version of the AppEngine docs claimed that key_name values
> couldn't be numbers (or start with numbers).  Perhaps that is related
> to the year old bug you describe?
>
> The current AppEngine docs have been revised (only the double
> underscore case remains), and a quick test confirms that 'numeric'
> key_name are allowed (as long as they are expressed as strings).
>
> o = Model.get_by_id( 42 )
> o = Model.get_by_key_name( '56' )
>
> The source of the value doesn't matter (URL, whatever).  The type does
> matter.
>
> o = Model.get_by_id( int( v ) )
> o = Model.get_by_key_name( str( v ) )
>
> Deciding which to use, from a mixed source (ids and key_names), can
> still be tricky. :)
>
> --
> G
>
>
> Ms. Jen wrote:
>> Avoid casting for what? The number 1 or for an id?
>>
>> Are you saying that one should not be attempting to request a
>> datastore ID from a URL?  From a search of this and other groups, over
>> a year ago there was a bug in getting by the ID, but it is not a bug
>> anymore.
>>
>> If I take out the in(self.request.get('id')), then I get an error that
>> says:
>> BadValueError: Unsupported type for property  : <type
>> 'builtin_function_or_method'>
>>
>> Do you have another way that you prefer to pass an identifier in the
>> URL path that then the identifier may be passed to the next datastore
>> search?  If so, please send link.
regex webapp.WSGIApplication('/([0-9]*)',AnyById), def get(self, id),
        key = str(db.Key.from_path('Any', int(id)))
        any = db.get(db.Key(key))
 Like thing By Id, Nameconventional somewhat related to "good name"
which could mean anything preferably ISO standard that lags newest
stuff we can use numbers to free space comparing AbyB and B2A. I now
use first convention like ThingById getting regexed id avoiding
casting stating Id2Thing compared to ThingById from montao.googlecode

--

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-appeng...@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.


Reply via email to