예제 #1
0
파일: views.py 프로젝트: shinkou/pywfman
def fbdelete(req, path=''):
	"""
	Delete file or folder
	"""
	try:
		fb = FBrowsee(path)
		fb.delete()
		c = 200
		s = '"%s" deleted successfully.' % path
	except Exception as e:
		c = 500
		s = 'Error deleting "%s".' % path
		logging.exception(s)
	return HttpResponse(s, CONTENT_TEXT, c)
예제 #2
0
파일: views.py 프로젝트: shinkou/pywfman
def fblist(req, path=''):
	"""
	List files and folders
	"""
	fb = FBrowsee(path)
	template = loader.get_template('wfman/list.html')
	context = Context({
		'current': fb
	})

	if fb.isDir():
		context['fblist'] = fb.list()

	return HttpResponse(template.render(context))
예제 #3
0
파일: views.py 프로젝트: shinkou/pywfman
def fbmove(req):
	"""
	Move file or folder
	"""
	import json, shutil

	if req.POST and req.POST['from'] and req.POST['to']:
		sFrom = req.POST['from']
		sTo = req.POST['to']
		try:
			fb = FBrowsee(req.POST['from'])
			fb.move(req.POST['to'])
			c = 200
			s = '"%s" moved to "%s" successfully.' % (sFrom, sTo)
		except IOError as ioe:
			c = 500
			s = "Unable to move: %s" % ioe
			logging.exception(s)
	return HttpResponse(s, CONTENT_TEXT, c)