Skip to content

Commit

Permalink
fix: Preemptively fix API change in NDB. (#7361)
Browse files Browse the repository at this point in the history
Glockenspiel broke due to 'query' now being required within a client context.  This change fixed Glockenspiel.  Blockly samples doesn't appear to be broken yet, but Glokenspeil broke at midnight yesterday.

Similar change being made to Blockly Games.
  • Loading branch information
NeilFraser committed Aug 7, 2023
1 parent 2a2b3b3 commit 826510f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion appengine/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def xmlToKey(xml_content):
# Store XML and return a generated key.
xml_hash = int(hashlib.sha1(xml_content.encode("utf-8")).hexdigest(), 16)
xml_hash = int(xml_hash % (2 ** 64) - (2 ** 63))
lookup_query = Xml.query(Xml.xml_hash == xml_hash)
client = ndb.Client()
with client.context():
lookup_query = Xml.query(Xml.xml_hash == xml_hash)
lookup_result = lookup_query.get()
if lookup_result:
xml_key = lookup_result.key.string_id()
Expand Down

0 comments on commit 826510f

Please sign in to comment.