예제 #1
0
파일: tests.py 프로젝트: robsws/gdpgroup9
	def test_error_invalid_presentationid(self):
		#not integer
		with self.assertRaises(APIInvalidParameterException):
			api.getTranscripts("text")
		#doesn't exist
		with self.assertRaises(SynoteObjectDoesNotExistException):
			api.getTranscripts(-1)
예제 #2
0
파일: ajax.py 프로젝트: robsws/gdpgroup9
def getPresentation(request):
	response = dict()
	presentationID = request.POST.get('presentationID', '')
	usr = -1
	if request.user.id:
		usr = request.user.id 
	try:
		response['presentation_meta'] = api.getPresentation(int(presentationID), int(usr))
		response['slides'] = api.getSlides(int(presentationID))
		response['transcripts'] = api.getTranscripts(int(presentationID))
		response['synmarks'] = api.getSynmarks(int(presentationID), int(usr)) 
		discussions = api.getPresentationsThreads(int(presentationID), int(usr))
		response['threads'] = simplejson.loads(serializers.serialize('json', discussions, indent=4, extras=('__unicode__', 'isSubscribed')))		
	except APIException as e:
		response['error'] = "There was a problem with your request. Please try again."
		api.log_error("APIException thrown ("+str(type(e))+"): "+e.value)
	returnJSON = simplejson.dumps(response)
	return HttpResponse(returnJSON, mimetype='application/json')
예제 #3
0
파일: views.py 프로젝트: robsws/gdpgroup9
def detail(request, presentationID, goTo = 0):
	context = initContext(request.user)

	try:
		if request.user.is_authenticated():
			synmarks = api.getSynmarks(int(presentationID), request.user.id)
			discussions = api.getPresentationsThreads(int(presentationID), request.user.id)
			
			context["threads"] = api.formatThreads(synmarks, discussions)
			context["presentation"] = api.getPresentation(int(presentationID), request.user.id)
			context["slides"] = api.getSlides(int(presentationID))
			context["transcripts"] = api.formatTranscript(api.getTranscripts(int(presentationID)))
			context["notification"] = api.getNotifications(request.user.id)
			return render(request, 'detail.html', context)
		else:
			context["error_text"] = "You may need to <a href='/'>login</a>."
			return render(request, 'apierror.html', context)
	except SynoteObjectDoesNotExistException as e:
		context["error_text"] = e.value
		api.log_error("APIException thrown ("+str(type(e))+"): "+e.value)
		return render(request, 'apierror.html', context)
예제 #4
0
파일: tests.py 프로젝트: robsws/gdpgroup9
	def test_normal(self):
		if not SYNOTE_TESTS_ON:
			skipTest("Test relies on Synote and SYNOTE_TESTS_ON is set False.")
		
		#just checking for errors running
		api.getTranscripts(PRESENTATION_ID)