Example #1
0
def createBag_create():	

	def abort(msg):
		# rollback changes?
		return msg


	# get username
	username = session['username']			
	print request.form
	form_results = request.form

	
	# make output dir
	try:
		print "Making directory..."
		# os.mkdir(form_results['outputLocation'])
	except:
		return abort("Directory already exists or could permissions restrict")


	# instantiate objMeta instance
	handle = ObjMeta(**{
			"id" : form_results['objID'],
			"label" : form_results['objLabel']			
		})

	# get content type
	content_rels = form_results['hasContentModel']
	# this is the price of WSUDOR_ContentTypes and Fedora CM:* content types...
	wct = "WSUDOR_"+json.loads(content_rels)['object'].split(":")[-1]
	print "WSUDOR Content Type:",wct
	handle.content_type = wct

	

	# debug
	print handle.toJSON()
	return handle.displayJSONWeb()