diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-08-31 00:19:58 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-31 00:19:58 +1000 |
commit | 14e4d4f4bf894f4e70118e03f4f4575e1eb6dab6 (patch) | |
tree | 1c7ba21ab2ebe5dbf4c7c15b0b89376fda865c31 /synapse/storage/events.py | |
parent | Merge pull request #3764 from matrix-org/rav/close_db_conn_after_init (diff) | |
download | synapse-14e4d4f4bf894f4e70118e03f4f4575e1eb6dab6.tar.xz |
Port storage/ to Python 3 (#3725)
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r-- | synapse/storage/events.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index f39c8c8461..8bf87f38f7 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -19,7 +19,7 @@ import logging from collections import OrderedDict, deque, namedtuple from functools import wraps -from six import iteritems +from six import iteritems, text_type from six.moves import range from canonicaljson import json @@ -1220,7 +1220,7 @@ class EventsStore(EventFederationStore, EventsWorkerStore, BackgroundUpdateStore "sender": event.sender, "contains_url": ( "url" in event.content - and isinstance(event.content["url"], basestring) + and isinstance(event.content["url"], text_type) ), } for event, _ in events_and_contexts @@ -1529,7 +1529,7 @@ class EventsStore(EventFederationStore, EventsWorkerStore, BackgroundUpdateStore contains_url = "url" in content if contains_url: - contains_url &= isinstance(content["url"], basestring) + contains_url &= isinstance(content["url"], text_type) except (KeyError, AttributeError): # If the event is missing a necessary field then # skip over it. @@ -1910,9 +1910,9 @@ class EventsStore(EventFederationStore, EventsWorkerStore, BackgroundUpdateStore (room_id,) ) rows = txn.fetchall() - max_depth = max(row[0] for row in rows) + max_depth = max(row[1] for row in rows) - if max_depth <= token.topological: + if max_depth < token.topological: # We need to ensure we don't delete all the events from the database # otherwise we wouldn't be able to send any events (due to not # having any backwards extremeties) |