1
0
Fork 0
mirror of synced 2024-06-27 02:31:04 +12:00

Corrected error where content was being overwritten

This commit is contained in:
phxntxm 2016-09-28 19:23:29 -05:00
parent bdacd6ae92
commit 19ff5c95b1

View file

@ -175,19 +175,13 @@ async def add_content(table, content, r_filter=None):
try:
if r_filter is not None:
cursor = await r.table(table).filter(r_filter).run(conn)
content = await _convert_to_list(cursor)
if len(content) > 0:
cur_content = await _convert_to_list(cursor)
if len(cur_content) > 0:
await conn.close()
return False
else:
await r.table(table).insert(content).run(conn)
await conn.close()
return True
else:
await r.table(table).insert(content).run(conn)
await conn.close()
return True
await r.table(table).insert(content).run(conn)
await conn.close()
return True
except r.ReqlOpFailedError:
# This means the table does not exist
await r.create_table(table).run(conn)