style
This commit is contained in:
parent
cd18efa40d
commit
dcc5e859a5
4 changed files with 8 additions and 8 deletions
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue