I ran into a fuzzy little thing today. I have to classes with the same
name in different modules and both inherits from the Model class
(let's call them x.A and y.A). I've created an instance of x.A (let's
call it a1) and put it to the datastore, i then referenced the
instance from an a.B entity (let's say b1). Now later fetching b1 and
accessing the a1 through the reference property on b1 i get an object
of the class y.A. How did this happen?

Maybe i should put this to code:

module x
class A(db.Model):
  name = db.StringProperty()
class B(db.Model):
  name = db.StringProperty
  other = db.ReferenceProperty(reference_class=A)

module y
class A(db.Model):
  name = db.StringProperty()

# now let's create som entities
a1 = x.A(name='Test')
a1.put()
b1 = x.B(name = 'Some Name', other=a1)
b1.put()
b2 = x.B.all().filter('name =', 'Some Name').get()
a2 = b2.other # now this will be an instance of y.A, even though we've
created no such instance or worked with module y in module a or the
end code snippet.

Magic, a bug, a feature?

Regards
Tonny
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to