allow removing old ids
This commit is contained in:
parent
a0d0d6fd9e
commit
cec7c12ac4
4 changed files with 13 additions and 5 deletions
|
@ -25,7 +25,7 @@ def version(module):
|
||||||
version += '-' + get('git', 'describe', '--always').strip()
|
version += '-' + get('git', 'describe', '--always').strip()
|
||||||
os.chdir(root_dir)
|
os.chdir(root_dir)
|
||||||
else:
|
else:
|
||||||
if module in settings.release['modules']:
|
if 'modules' in settings.release and module in settings.release['modules']:
|
||||||
version = settings.release['modules'][module]['version']
|
version = settings.release['modules'][module]['version']
|
||||||
else:
|
else:
|
||||||
version = -1
|
version = -1
|
||||||
|
|
|
@ -112,6 +112,7 @@ class Node(Thread):
|
||||||
u = self.user
|
u = self.user
|
||||||
self.user_id = r['id']
|
self.user_id = r['id']
|
||||||
u.migrate_id(self.user_id)
|
u.migrate_id(self.user_id)
|
||||||
|
self._opener = get_opener(self.user_id)
|
||||||
|
|
||||||
def get_local(self):
|
def get_local(self):
|
||||||
if self._nodes and self._nodes._local:
|
if self._nodes and self._nodes._local:
|
||||||
|
|
|
@ -53,7 +53,8 @@ def get(url, filename=None):
|
||||||
|
|
||||||
def check():
|
def check():
|
||||||
if settings.release:
|
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'))
|
release = json.loads(release_data.decode('utf-8'))
|
||||||
old = current_version('openmedialibrary')
|
old = current_version('openmedialibrary')
|
||||||
new = release['modules']['openmedialibrary']['version']
|
new = release['modules']['openmedialibrary']['version']
|
||||||
|
@ -61,7 +62,13 @@ def check():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def current_version(module):
|
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():
|
def download():
|
||||||
if not os.path.exists(os.path.join(settings.config_path, 'release.json')):
|
if not os.path.exists(os.path.join(settings.config_path, 'release.json')):
|
||||||
|
|
|
@ -341,7 +341,7 @@ def rejectPeering(data):
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
if len(data.get('id', '')) != 16:
|
if len(data.get('id', '')) not in (16, 43):
|
||||||
logger.debug('invalid user id')
|
logger.debug('invalid user id')
|
||||||
return {}
|
return {}
|
||||||
u = models.User.get_or_create(data['id'])
|
u = models.User.get_or_create(data['id'])
|
||||||
|
@ -360,7 +360,7 @@ def removePeering(data):
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
if len(data.get('id', '')) != 16:
|
if len(data.get('id', '')) not in (16, 43):
|
||||||
logger.debug('invalid user id')
|
logger.debug('invalid user id')
|
||||||
return {}
|
return {}
|
||||||
u = models.User.get_or_create(data['id'])
|
u = models.User.get_or_create(data['id'])
|
||||||
|
|
Loading…
Reference in a new issue