예제 #1
0
def index(request):
	gitPath = getGitPath()
	try:
		pathpar = request.GET['path']
	except KeyError:
		pathpar = ""
	currPath = getGitPath() + pathpar
	subDirs = []
	contents = listdir(currPath)
	for content in contents:
		fullPath = currPath + sep + content
		if isdir(fullPath):
			if not isdir(fullPath + sep + ".git") and not isdir(fullPath + sep + "refs"):
				toAdd = True
				for excl in settings.GIT_EXCLUDE_PATH:
					if re.match(excl, content):
						toAdd = False
				if toAdd:
					subDirs.append(content)
	subDirs = sorted(subDirs)
	repos = GitRepo.getRepos(currPath, False, settings.GIT_EXCLUDE_PATH)
	return render_to_response("index.html", RequestContext(request, {'gitPath': gitPath, 'currPath': currPath,
	                                                                 'gitBasicUrl': settings.GIT_BASIC_URL,
	                                                                 'subDirs': subDirs, 'repos': repos}))