try: ret = seafserv_rpc.is_passwd_set(repo_id, username) if ret == 1: password_set = True except SearpcError, e: return render_error(request, e.msg) if not password_set: return HttpResponseRedirect(reverse("view_common_lib_dir", args=[repo_id, ''])) commit_id = request.GET.get('commit_id', '') if not commit_id: return render_error(request, _(u'Please specify history ID')) try: seafserv_threaded_rpc.revert_on_server(repo_id, commit_id, request.user.username) except SearpcError, e: if e.msg == 'Bad arguments': return render_error(request, _(u'Invalid arguments')) elif e.msg == 'No such repo': return render_error(request, _(u'Library does not exist')) elif e.msg == "Commit doesn't exist": return render_error(request, _(u'History you specified does not exist')) else: return render_error(request, _(u'Unknown error')) return HttpResponseRedirect(next) def fpath_to_link(repo_id, path, is_dir=False): """Translate file path of a repo to its view link""" if is_dir:
except SearpcError, e: return render_error(request, e.msg) if not password_set: reverse_url = HASH_URLS["VIEW_COMMON_LIB_DIR"] % { 'repo_id': repo_id, 'path': '' } return HttpResponseRedirect(reverse_url) commit_id = request.GET.get('commit_id', '') if not commit_id: return render_error(request, _(u'Please specify history ID')) try: seafserv_threaded_rpc.revert_on_server(repo_id, commit_id, request.user.username) messages.success(request, _('Successfully restored the library.')) except SearpcError, e: if e.msg == 'Bad arguments': return render_error(request, _(u'Invalid arguments.')) elif e.msg == 'No such repo': return render_error(request, _(u'Library does not exist')) elif e.msg == "Commit doesn't exist": return render_error(request, _(u'History you specified does not exist')) else: return render_error(request, _(u'Unknown error')) return HttpResponseRedirect(next)