allow removing old ids

This commit is contained in:
j 2015-11-26 13:40:39 +01:00
parent a0d0d6fd9e
commit cec7c12ac4
4 changed files with 13 additions and 5 deletions

View file

@ -25,7 +25,7 @@ def version(module):
version += '-' + get('git', 'describe', '--always').strip()
os.chdir(root_dir)
else:
if module in settings.release['modules']:
if 'modules' in settings.release and module in settings.release['modules']:
version = settings.release['modules'][module]['version']
else:
version = -1

View file

@ -112,6 +112,7 @@ class Node(Thread):
u = self.user
self.user_id = r['id']
u.migrate_id(self.user_id)
self._opener = get_opener(self.user_id)
def get_local(self):
if self._nodes and self._nodes._local:

View file

@ -53,7 +53,8 @@ def get(url, filename=None):
def check():
if settings.release:
release_data = get(settings.server.get('release_url', 'http://downloads.openmedialibrary.com/release.json'))
release_data = get(settings.server.get('release_url',
'http://downloads.openmedialibrary.com/release.json'))
release = json.loads(release_data.decode('utf-8'))
old = current_version('openmedialibrary')
new = release['modules']['openmedialibrary']['version']
@ -61,7 +62,13 @@ def check():
return False
def current_version(module):
return settings.release['modules'][module]['version'] if module in settings.release['modules'] else ""
if 'modules' in settings.release \
and module in settings.release['modules'] \
and 'version' in settings.release['modules'][module]:
version = settings.release['modules'][module]['version']
else:
version = ''
return version
def download():
if not os.path.exists(os.path.join(settings.config_path, 'release.json')):

View file

@ -341,7 +341,7 @@ def rejectPeering(data):
message
}
'''
if len(data.get('id', '')) != 16:
if len(data.get('id', '')) not in (16, 43):
logger.debug('invalid user id')
return {}
u = models.User.get_or_create(data['id'])
@ -360,7 +360,7 @@ def removePeering(data):
message
}
'''
if len(data.get('id', '')) != 16:
if len(data.get('id', '')) not in (16, 43):
logger.debug('invalid user id')
return {}
u = models.User.get_or_create(data['id'])