Reformatted manage.py

This commit is contained in:
Sybren A. Stüvel 2016-05-06 12:11:55 +02:00
parent 6f193da89d
commit 410ecac78c

View File

@ -262,13 +262,13 @@ def manage_groups():
client = MongoClient(MONGO_HOST, 27017)
db = client.eve
print ("")
print ("Add or Remove user from group")
print ("leave empty to cancel")
print ("")
print("")
print("Add or Remove user from group")
print("leave empty to cancel")
print("")
# Select Action
print ("Do you want to Add or Remove the user from the group?")
print("Do you want to Add or Remove the user from the group?")
retry = True
while retry:
action = raw_input('add/remove: ')
@ -281,7 +281,7 @@ def manage_groups():
action = 'remove'
retry = False
else:
print ("Incorrect action, press type 'add' or 'remove'")
print("Incorrect action, press type 'add' or 'remove'")
# Select User
retry = True
@ -293,7 +293,7 @@ def manage_groups():
if user:
retry = False
else:
print ("Incorrect user email, try again, or leave empty to cancel")
print("Incorrect user email, try again, or leave empty to cancel")
# Select group
retry = True
@ -305,7 +305,7 @@ def manage_groups():
if group:
retry = False
else:
print ("Incorrect group name, try again, or leave empty to cancel")
print("Incorrect group name, try again, or leave empty to cancel")
# Do
current_groups = user.get('groups', [])
@ -386,6 +386,7 @@ def add_parent_to_nodes():
sys.stdout = UTF8Writer(sys.stdout)
nodes_collection = app.data.driver.db['nodes']
def find_parent_project(node):
if node and 'parent' in node:
parent = nodes_collection.find_one({'_id': node['parent']})
@ -394,6 +395,7 @@ def add_parent_to_nodes():
return node
else:
return None
nodes = nodes_collection.find()
nodes_index = 0
nodes_orphan = 0
@ -467,7 +469,7 @@ def convert_assets_to_textures(project_id):
return dict(variation=variation, is_tileable=is_tileable)
def make_texture_node(base_node, files, parent_id=None):
texture_node_type = node_types_collection.find_one({'name':'texture'})
texture_node_type = node_types_collection.find_one({'name': 'texture'})
files_list = []
is_tileable = False
@ -519,7 +521,6 @@ def convert_assets_to_textures(project_id):
import pprint
pprint.pprint(node)
nodes_collection = app.data.driver.db['nodes']
for n in nodes_collection.find({'project': ObjectId(project_id)}):
@ -535,7 +536,7 @@ def convert_assets_to_textures(project_id):
elif n_type['name'] == 'group':
# Change group type to texture group
node_type_texture = node_types_collection.find_one(
{'name':'group_texture'})
{'name': 'group_texture'})
n['node_type'] = node_type_texture['_id']
n['properties'].pop('notes', None)
print("Updating {0}".format(n['name']))
@ -707,6 +708,7 @@ def files_make_public_t():
except Exception:
pass
@manager.command
def subscribe_node_owners():
"""Automatically subscribe node owners to notifications for items created