Skip to content

Commit 2d00167

Browse files
committed
Edited auto_batch
1 parent 1c94b28 commit 2d00167

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

client_code/auto_batch.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,20 @@ def __setitem__(self, column, value):
160160
self.update(**{column: value})
161161

162162
@if_not_deleted
163-
def update(self, **column_values):
163+
def update(*args, **column_values):
164164
global _update_queue
165+
if len(args) > 2:
166+
raise TypeError("expected at most 1 argument, got %d" % (len(args) - 1))
167+
elif len(args) == 2:
168+
column_values = dict(args[1], **column_values)
169+
self = args[0]
170+
if not column_values:
171+
# backwards compatability hack
172+
if _add_queue or _update_queue or _delete_queue:
173+
print("AutoBatch: process_batch triggered early by row.update() w/o args")
174+
process_batch()
175+
self.clear_cache()
176+
return
165177
unwrapped_column_values = _unwrap_any_row_values(column_values)
166178
if not _batching:
167179
return self.row.update(**unwrapped_column_values)

0 commit comments

Comments
 (0)