> In my code I have two variables that point to an entity that is the
> result of some query.
How do you get those two variables?
Did you do:
v1 = {some query/get}
v2 = v1
or
v1 = {some query/get}
v2 = {some query/get}
In the first case, v1 and v2 are "pointing to" the same db.Model
instance. Changing something via v1 will be visible via v2 (as long
as you don't assign to either v1 or v2).
In the second case, v1 and v2 are "pointing to" different db.Model
instances. Changing something via v1 will not change the instance
"pointed to" by v2.
Be sure that you understand why I'm writing "db.Model instance" and
not "datastore entity". Queries and db.get copy datastore entities
into db.Model instances which you can then manipulate. Put copies
db.Model instances into the datastore as entities. It's important to
realize that entities and db.Model instances can change independently
of one another.
On Mar 6, 6:58 am, solidus <[email protected]> wrote:
> Hello,
>
> In my code I have two variables that point to an entity that is the
> result of some query. I then modify some of the properties using one
> of the variables and then call put() on that variable. These changes
> do not propagate to the 2nd variable that was pointing to that entity.
> This leads me to believe that these are just copies of the underlying
> datastore record and not references. Is this correct?
>
> What's the best practice when it comes to things like this?
>
> i.e., I have a session variable that is a datastore entity with all
> the user's info. Some parts of my site may make changes to this entity
> and update the datastore, but the session entity does not see these
> changes unless I re-query the datastore.
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---