-from django.http import HttpResponseRedirect, HttpResponse
-from django.contrib.auth.decorators import login_required
-
-from explorer import forms, models
-
-repo = hg.Repository(settings.REPOSITORY_PATH)
-
-def file_list(request):
- return direct_to_template(request, 'explorer/file_list.html', extra_context={
- 'objects': repo.all_files(),
- })
-
-
-#
-# Edit the file
-#
-def file_xml(request, path):
- if request.method == 'POST':
- form = forms.BookForm(request.POST)
- if form.is_valid():
- print 'Saving whole text.', request.user.username
- def save_action():
- repo.add_file(path, form.cleaned_data['content'])
- repo.commit(message='Local save at %s' % time.ctime(), user=request.user.username)
-
- repo.in_branch('local_'+request.user.username, save_action);
- result = "ok"
- else:
- result = "error"