This commit is contained in:
j 2019-01-11 15:18:53 +05:30
parent cd18efa40d
commit dcc5e859a5
4 changed files with 8 additions and 8 deletions

View file

@ -116,7 +116,7 @@ def drop_columns(table, columns):
}
create_table = get_create_table(table)
for column in columns:
create_table = re.sub('(%s .*?,)'%column, '', create_table)
create_table = re.sub('(%s .*?,)' % column, '', create_table)
create_table = create_table.replace('\n', '').replace(',', ',\n')
create_table = re.sub('\n *', '\n ', create_table).replace('( ', '(\n ')
sql = [

View file

@ -9,7 +9,7 @@ from sqlalchemy.sql.expression import text
from sqlalchemy import func
from oxtornado import actions
import utils #utils must be imported before websocket to avoid loop
import utils # utils must be imported before websocket to avoid loop
from websocket import trigger_event
import meta
from . import models

View file

@ -93,7 +93,7 @@ class Peer(object):
elif action == 'edititem':
itemid, meta = args
item = self.library.get(itemid, {})
if not 'meta' in item:
if 'meta' not in item:
item['meta'] = meta
else:
item['meta'].update(meta)
@ -111,7 +111,7 @@ class Peer(object):
name = args[0]
if len(args) > 1:
query = args[1]
if not name in self.info['lists']:
if name not in self.info['lists']:
self.info['lists'][name] = []
elif action == 'editlist':
name, new = args
@ -127,7 +127,7 @@ class Peer(object):
del self.info['lists'][name]
elif action == 'addlistitems':
name, ids = args
if not name in self.info['lists']:
if name not in self.info['lists']:
self.info['lists'][name] = []
self.info['lists'][name] = list(set(self.info['lists'][name]) | set(ids))
elif action == 'removelistitems':
@ -141,14 +141,14 @@ class Peer(object):
# fixme, just trigger peer update here
from user.models import User
peer = User.get_or_create(peerid)
if not 'username' in peer.info:
if 'username' not in peer.info:
peer.info['username'] = username
peer.update_name()
peer.save()
elif action == 'editpeer':
peerid, data = args
if len(peerid) == 16:
if not peerid in self.info['peers']:
if peerid not in self.info['peers']:
self.info['peers'][peerid] = {}
for key in ('username', 'contact'):
if key in data:

View file

@ -21,7 +21,7 @@ class pdict(dict):
json.dump(self, fd, indent=4, sort_keys=True, ensure_ascii=False)
def get(self, key, default=None):
if default == None and self._defaults:
if default is None and self._defaults:
default = self._defaults.get(key)
return dict.get(self, key, default)