Thanks Guido,

I removed the default argument and things are working as expected.

-Robert

On Sat, Jul 28, 2012 at 2:42 PM, Guido van Rossum <gu...@google.com> wrote:

> The "default=[]" is causing this. All instances share the same list object
> this way. You'll have to find some other way of initializing the value.
> Maybe you cna just use a repeated string property?
>
>
> On Saturday, July 28, 2012 11:56:46 AM UTC-7, Robert Fischer wrote:
>>
>> Hi,
>>
>> I'm creating a new instance of a model and it's getting the data from the
>> previous model I created.
>>
>> Any idea what could be happening here?
>>
>> class Keyword(ndb.Model):
>>     user_owner = ndb.UserProperty()
>>     description = ndb.StringProperty(indexed=**False)
>>     time_created = ndb.DateTimeProperty(auto_now_**add=True,
>> indexed=False)
>>     deleted = ndb.BooleanProperty(default=**False)
>>     keyword_list = ndb.StringProperty(repeated=**True, indexed=True)
>> #Indexed
>>     required_keyword_list = ndb.StringProperty(repeated=**True,
>> indexed=False)
>>
>>     threshold = ndb.IntegerProperty(indexed=**False)
>>
>>      last_found_on_id = ndb.StringProperty(indexed=**False)
>>     ids_found_on = ndb.JsonProperty(default=[], indexed=False)
>>     times_found = ndb.ComputedProperty(lambda self:
>> len(self.ids_found_on)) #Indexed
>>     time_last_found = ndb.DateTimeProperty(indexed=**False)
>>
>> class KeywordHandler(webapp2.**RequestHandler)
>>     def post(self):
>>         ...
>>         logging.warning('Creating new keyword object.')
>>         keyword_to_save = Keyword()
>>         logging.warning('ids associated with keyword: %s %s %s' %
>> (str(keyword_to_save.key), str(keyword_to_save),
>> keyword_to_save.ids_found_on))
>>         ...
>>
>> The first time I run this it works great:
>> WARNING  2012-07-28 18:27:32,403 frontend_keywords.py:176] ids associated
>> with keyword: None Keyword() []
>>
>> When run a second time I get this in my log file -- why is the
>> ids_found_on already populated for a new model instance? The ids_found_on
>> matches the previously created entity:
>>
>> WARNING  2012-07-28 18:27:40,459 frontend_keywords.py:176] ids associated
>> with keyword: None Keyword() ['ahBkZXZ-**ZGVhbHNjb3JjaGVyciwLEghSU1NFbn**
>> RyeSIeMjAxMi0wNy0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eSIeMjAxMi0wNy0yNiAwMTo0MDoz
>> **OS1jcmFmdHNtYW4gDA', 'ahBkZXZ-**ZGVhbHNjb3JjaGVyciwLEghSU1NFbn**
>> RyeSIeMjAxMi0wNy0yNiAxMjoxMjoz**OC1ib3cgcmFrZSB3DA', 'ahBkZXZ-**
>> ZGVhbHNjb3JjaGVyciwLEghSU1NFbn**RyeSIeMjAxMi0wNy0yNiAxNzo1NDoy**OC00MSB2b3JuYWRvDA',
>> 'ahBkZXZ-**ZGVhbHNjb3JjaGVyciwLEghSU1NFbn**RyeSIeMjAxMi0wNy0yNiAxODowNDoy
>> **OC1sb2dpdGVjaCBoDA']
>>
>> Thanks,
>> Robert
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/F0VkBIsYR2YJ.
>
> 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.
>

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

Reply via email to