diff options
author | Erik Johnston <erik@matrix.org> | 2014-08-14 17:34:37 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-08-14 17:34:37 +0100 |
commit | 661c7117659118ed977f56a092525dbdae9dc67c (patch) | |
tree | 8284cb857d98c920bb66f70d504cf716d4a613c5 /synapse/storage | |
parent | Fix typo (diff) | |
download | synapse-661c7117659118ed977f56a092525dbdae9dc67c.tar.xz |
Start fixing places that use the data store.
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/__init__.py | 8 | ||||
-rw-r--r-- | synapse/storage/_base.py | 2 | ||||
-rw-r--r-- | synapse/storage/feedback.py | 4 | ||||
-rw-r--r-- | synapse/storage/roommember.py | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py index afdd75f46d..182b6ebadd 100644 --- a/synapse/storage/__init__.py +++ b/synapse/storage/__init__.py @@ -21,13 +21,11 @@ from synapse.api.events.room import ( from .directory import DirectoryStore from .feedback import FeedbackStore -from .message import MessageStore from .presence import PresenceStore from .profile import ProfileStore from .registration import RegistrationStore from .room import RoomStore from .roommember import RoomMemberStore -from .roomdata import RoomDataStore from .stream import StreamStore from .pdu import StatePduStore, PduStore from .transactions import TransactionStore @@ -36,7 +34,7 @@ import json import os -class DataStore(RoomDataStore, RoomMemberStore, MessageStore, RoomStore, +class DataStore(RoomMemberStore, RoomStore, RegistrationStore, StreamStore, ProfileStore, FeedbackStore, PresenceStore, PduStore, StatePduStore, TransactionStore, DirectoryStore): @@ -78,7 +76,7 @@ class DataStore(RoomDataStore, RoomMemberStore, MessageStore, RoomStore, def _store_event(self, event): vals = { "event_id": event.event_id, - "event_type", event.type, + "event_type": event.type, "sender": event.user_id, "room_id": event.room_id, "content": json.dumps(event.content), @@ -105,7 +103,7 @@ class DataStore(RoomDataStore, RoomMemberStore, MessageStore, RoomStore, # TODO (erikj): We also need to update the current state table? @defer.inlineCallbacks - def get_current_state(room_id, event_type=None, state_key="") + def get_current_state(room_id, event_type=None, state_key=""): sql = ( "SELECT e.* FROM events as e" "INNER JOIN current_state as c ON e.event_id = c.event_id " diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index 7fef8601e7..533f509709 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -293,7 +293,7 @@ class SQLBaseStore(object): def _parse_event_from_row(self, row_dict): d = copy.deepcopy({k: v for k, v in row.items() if v}) d.update(json.loads(json.loads(row["unrecognized_keys"]))) - d["content"] = json.loads(d["content"}) + d["content"] = json.loads(d["content"]) del d["unrecognized_keys"] return self.event_factory.create_event( diff --git a/synapse/storage/feedback.py b/synapse/storage/feedback.py index dd5f3fbc10..e60f98d1e1 100644 --- a/synapse/storage/feedback.py +++ b/synapse/storage/feedback.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from twisted.internet import defer + from ._base import SQLBaseStore, Table from synapse.api.events.room import FeedbackEvent @@ -31,7 +33,7 @@ class FeedbackStore(SQLBaseStore): "sender": event.user_id, }) - @defer.inlineCallback + @defer.inlineCallbacks def get_feedback_for_event(self, event_id): sql = ( "SELECT events.* FROM events INNER JOIN feedback " diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index c99cefbcfc..14c0152e8a 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -112,7 +112,7 @@ class RoomMemberStore(SQLBaseStore): args = [user_id] args.extend(membership_list) - where_clause "user_id = ? AND (%s)" % ( + where_clause = "user_id = ? AND (%s)" % ( " OR ".join(["membership = ?" for _ in membership_list]), ) |