refactored info command for pyinstaller

This commit is contained in:
Felix Lohmeier 2019-08-22 00:36:18 +02:00
parent bd13ffeb50
commit 97bada2254
1 changed files with 15 additions and 18 deletions

View File

@ -186,25 +186,22 @@ def export(project_id, encoding=None, output_file=None, export_format=None):
def info(project_id): def info(project_id):
"""Show project metadata""" """Show project metadata"""
projects = refine.Refine(refine.RefineServer()).list_projects().items() projects = refine.Refine(refine.RefineServer()).list_projects()
if project_id in [item[0] for item in projects]: if project_id in projects.keys():
project = refine.RefineProject(project_id) projectName = projects[project_id]['name']
projects = refine.Refine(refine.RefineServer()).list_projects().items() print('{0:>20}: {1}'.format('id', project_id))
for projects_id, projects_info in projects: print('{0:>20}: {1}'.format('url', 'http://' +
if project_id == projects_id: refine.REFINE_HOST + ':' +
print('{0:>20}: {1}'.format('id', project_id)) refine.REFINE_PORT +
print('{0:>20}: {1}'.format('url', 'http://' + '/project?project=' + project_id))
refine.REFINE_HOST + ':' + print(u'{0:>20}: {1}'.format(u'name', projectName))
refine.REFINE_PORT + for k, v in projects[project_id].items():
'/project?project=' + project_id)) if v and k != 'name':
for k, v in projects_info.items(): print(u'{0:>20}: {1}'.format(k, v))
if v: project_model = refine.RefineProject(project_id).get_models()
print(u'{0:>20}: {1}'.format(k, v)) columns = [c['name'] for c in project_model['columnModel']['columns']]
project_model = project.get_models()
column_model = project_model['columnModel']
columns = [column['name'] for column in column_model['columns']]
for (i, v) in enumerate(columns, start=1): for (i, v) in enumerate(columns, start=1):
print(u'{0:>20}: {1}'.format('column ' + str(i).zfill(3), v)) print(u'{0:>20}: {1}'.format(u'column ' + str(i).zfill(3), v))
else: else:
print('Error: No project found with id %s.\n' print('Error: No project found with id %s.\n'
'Check existing projects with command --list' % (project_id)) 'Check existing projects with command --list' % (project_id))