Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Fixing the case when a property indexing is changed in both directions #79

Merged
merged 1 commit into from
Jul 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions db.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ def __setitem__(self, name, value):
value = None
super( Entity, self ).__setitem__( name, value )

def set( self, key, value, indexed=True ):
def set(self, key, value, indexed=True):
"""
Sets a property.

Expand All @@ -1091,11 +1091,16 @@ def set( self, key, value, indexed=True ):
empty string or not a string.
:raises: :exc:`BadValueError` if the value is not a supported type.
"""
if not indexed:
unindexed = list( self.getUnindexedProperties() )
if not key in unindexed:
self.setUnindexedProperties( unindexed+[key] )
self[ key ] = value
unindexed = list(self.getUnindexedProperties())

if not indexed and not key in unindexed:
unindexed.append(key)
self.setUnindexedProperties(unindexed)
elif indexed and key in unindexed:
unindexed.remove(key)
self.setUnindexedProperties(unindexed)

self[key] = value

@staticmethod
def FromDatastoreEntity( entity ):
Expand Down