Esempio n. 1
0
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)
Esempio n. 2
0
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))
Esempio n. 3
0
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)