Пример #1
0
def process_hook(func, args):
    """
    Generic helper for processing hook commands.
    """
    credentials = None
    if args.login_user and args.login_pass:
        credentials = {
            'GITHUB_USER': args.login_user,
            'GITHUB_PASSWORD': args.login_pass
        }

    with app.app_context():
        if credentials:
            credentials['GITHUB_URL'] = app.config['GITHUB_URL']
            gh = github.get_client(
                credentials,
                args.user,
                args.repo)
        else:
            gh = github.get_client(
                app.config,
                args.user,
                args.repo)
        endpoint = url_for('start_review', _external=True)
    func(gh, endpoint, args.user, args.repo)
Пример #2
0
def process_hook(func, args):
    """
    Generic helper for processing hook commands.
    """
    credentials = None
    if args.login_user and args.login_pass:
        credentials = {
            'GITHUB_USER': args.login_user,
            'GITHUB_PASSWORD': args.login_pass
        }

    with app.app_context():
        if credentials:
            credentials['GITHUB_URL'] = app.config['GITHUB_URL']
            repo = github.get_repository(
                credentials,
                args.user,
                args.repo)
        else:
            repo = github.get_repository(
                app.config,
                args.user,
                args.repo)
        endpoint = url_for('start_review', _external=True)
    func(repo, endpoint)