Fix robot renaming. Allow for trigger URLs to contain or omit the repository in the path. Fix calls to get_trigger to remove the namespace and repository.

This commit is contained in:
Jake Moshenko 2014-11-18 10:24:48 -05:00
parent f4681f2c18
commit a7bae6c1d9
4 changed files with 24 additions and 17 deletions

View file

@ -294,11 +294,17 @@ def delete_robot(robot_username):
robot_username)
def list_entity_robots(entity_name):
selected = User.select(User.username, FederatedLogin.service_ident)
joined = selected.join(FederatedLogin)
return joined.where(User.robot == True,
User.username ** (entity_name + '+%')).tuples()
def _list_entity_robots(entity_name):
return (User
.select()
.join(FederatedLogin)
.where(User.robot == True, User.username ** (entity_name + '+%')))
def list_entity_robot_tuples(entity_name):
return (_list_entity_robots(entity_name)
.select(User.username, FederatedLogin.service_ident)
.tuples())
def convert_user_to_organization(user, admin_user):
@ -893,7 +899,7 @@ def change_username(user, new_username):
with config.app_config['DB_TRANSACTION_FACTORY'](db):
# Rename the robots
for robot in list_entity_robots(user.username):
for robot in _list_entity_robots(user.username):
_, robot_shortname = parse_robot_username(robot.username)
new_robot_name = format_robot_username(new_username, robot_shortname)
robot.username = new_robot_name