Пример #1
0
def refresh_repositories(username, token):
    from bakery.app import github
    from bakery.github import GithubSessionAPI, GithubSessionException
    from bakery.settings.models import ProjectCache
    _github = GithubSessionAPI(github, token)
    try:
        repos = _github.get_repo_list()
        ProjectCache.refresh_repos(repos, username)
    except GithubSessionException, ex:
        print(ex.message)
Пример #2
0
def update():
    """Update the list of the user's github repos"""
    if g.user is not None:
        if g.user.login != u'offline':
            _github = GithubSessionAPI(github, g.user.token)
            try:
                _repos = _github.get_repo_list()
                ProjectCache.refresh_repos(_repos, g.user.login)
                if _repos:
                    flash(_('Repositories refreshed.'))
            except GithubSessionException, ex:
                flash(ex.message)
        else:
            flash(_('Offline user has no Github account.'))