Py3 compatibility of ContentFilter plugin

This commit is contained in:
shortcutme 2019-03-16 02:20:32 +01:00
parent 4fe4d0a7e7
commit 883c2851ff
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 2 additions and 2 deletions

View File

@ -105,7 +105,7 @@ class ContentFilterStorage(object):
def save(self):
s = time.time()
helper.atomicWrite(self.file_path, json.dumps(self.file_content, indent=2, sort_keys=True))
helper.atomicWrite(self.file_path, json.dumps(self.file_content, indent=2, sort_keys=True).encode("utf8"))
self.log.debug("Saved in %.3fs" % (time.time() - s))
def isMuted(self, auth_address):
@ -123,7 +123,7 @@ class ContentFilterStorage(object):
# Search and remove or readd files of an user
def changeDbs(self, auth_address, action):
self.log.debug("Mute action %s on user %s" % (action, auth_address))
res = self.site_manager.list().values()[0].content_manager.contents.db.execute(
res = list(self.site_manager.list().values())[0].content_manager.contents.db.execute(
"SELECT * FROM content LEFT JOIN site USING (site_id) WHERE inner_path LIKE :inner_path",
{"inner_path": "%%/%s/%%" % auth_address}
)