def do_populate(): """ :param dict scope_dict: Given a dictionary of scope definitions, {name: scope_namedtuple}, load the resulting data into a database collection :return: """ scope_dict = oauth_scopes.public_scopes # Clear the scope collection and populate w/ only public scopes, # nothing references these objects other than CAS in name only. ApiOAuth2Scope.remove() for name, scope in scope_dict.iteritems(): # Update a scope if it exists, else populate if scope.is_public is True: get_or_create(name, scope.description, save=True) else: logger.info("{} is not a publicly advertised scope; did not load into database".format(name))
def do_populate(): """ :param dict scope_dict: Given a dictionary of scope definitions, {name: scope_namedtuple}, load the resulting data into a database collection :return: """ scope_dict = oauth_scopes.public_scopes # Clear the scope collection and populate w/ only public scopes, # nothing references these objects other than CAS in name only. ApiOAuth2Scope.remove() for name, scope in scope_dict.iteritems(): # Update a scope if it exists, else populate if scope.is_public is True: get_or_create(name, scope.description, save=True) else: logger.info( "{} is not a publicly advertised scope; did not load into database" .format(name))