diff --git a/progit/app.py b/progit/app.py index 511fbf9..0823bca 100644 --- a/progit/app.py +++ b/progit/app.py @@ -52,11 +52,11 @@ def index(): ) -@APP.route('/') -def view_user(user): +@APP.route('/') +def view_user(username): """ Front page of a specific user. """ - user_folder = os.path.join(APP.config['GIT_FOLDER'], user) + user_folder = os.path.join(APP.config['GIT_FOLDER'], username) if not os.path.exists(user_folder): flask.abort(404) @@ -68,7 +68,8 @@ def view_user(user): repos = sorted(os.listdir(user_folder)) repos_obj = [ - pygit2.Repository(os.path.join(APP.config['GIT_FOLDER'], user, repo)) + pygit2.Repository( + os.path.join(APP.config['GIT_FOLDER'], username, repo)) for repo in repos] limit = APP.config['ITEM_PER_PAGE'] @@ -80,7 +81,7 @@ def view_user(user): return flask.render_template( 'user_info.html', - username=user, + username=username, repos=repos, repos_obj=repos_obj, total_page=total_page, @@ -88,11 +89,11 @@ def view_user(user): ) -@APP.route('//') -def view_repo(user, repo): +@APP.route('//') +def view_repo(username, repo): """ Front page of a specific repo. """ - reponame = os.path.join(APP.config['GIT_FOLDER'], user, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame) @@ -115,11 +116,11 @@ def view_repo(user, repo): ) -@APP.route('///branch/') -def view_repo_branch(user, repo, branchname): +@APP.route('///branch/') +def view_repo_branch(username, repo, branchname): """ Displays the information about a specific branch. """ - reponame = os.path.join(APP.config['GIT_FOLDER'], user, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame) @@ -147,12 +148,12 @@ def view_repo_branch(user, repo, branchname): ) -@APP.route('///log') -@APP.route('///log/') -def view_log(user, repo, branchname=None): +@APP.route('///log') +@APP.route('///log/') +def view_log(username, repo, branchname=None): """ Displays the logs of the specified repo. """ - reponame = os.path.join(APP.config['GIT_FOLDER'], user, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame) @@ -196,12 +197,12 @@ def view_log(user, repo, branchname=None): ) -@APP.route('///blob//') -@APP.route('///blob//') -def view_file(user, repo, identifier, filename): +@APP.route('///blob//') +@APP.route('///blob//') +def view_file(username, repo, identifier, filename): """ Displays the content of a file or a tree for the specified repo. """ - reponame = os.path.join(APP.config['GIT_FOLDER'], user, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame) @@ -261,11 +262,11 @@ def view_file(user, repo, identifier, filename): ) -@APP.route('///') -def view_commit(user, repo, commitid): +@APP.route('///') +def view_commit(username, repo, commitid): """ Render a commit in a repo """ - reponame = os.path.join(APP.config['GIT_FOLDER'], user, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame) @@ -302,12 +303,12 @@ def view_commit(user, repo, commitid): ) -@APP.route('///tree/') -@APP.route('///tree/') -def view_tree(user, repo, identifier=None): +@APP.route('///tree/') +@APP.route('///tree/') +def view_tree(username, repo, identifier=None): """ Render the tree of the repo """ - reponame = os.path.join(APP.config['GIT_FOLDER'], user, repo) + reponame = os.path.join(APP.config['GIT_FOLDER'], username, repo) if not os.path.exists(reponame): flask.abort(404) repo_obj = pygit2.Repository(reponame)