예제 #1
0
파일: tests.py 프로젝트: robsws/gdpgroup9
	def test_error_invalid_presentationid(self):
		#not integer
		with self.assertRaises(APIInvalidParameterException):
			api.getPresentationsThreads("text", USER_ID)
		#doesn't exist
		with self.assertRaises(SynoteObjectDoesNotExistException):
			api.getPresentationsThreads(-1, USER_ID)
예제 #2
0
파일: tests.py 프로젝트: robsws/gdpgroup9
	def test_error_invalid_userid(self):
		#not integer
		with self.assertRaises(APIInvalidParameterException):
			api.getPresentationsThreads(PRESENTATION_ID, "text")
		#doesn't exist
		with self.assertRaises(ObjectDoesNotExist):
			api.getPresentationsThreads(PRESENTATION_ID, -2)
예제 #3
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 currently
		synmarks = api.getSynmarks(PRESENTATION_ID, USER_ID)
		discussions = api.getPresentationsThreads(PRESENTATION_ID, USER_ID)
		threads = api.formatThreads(synmarks, discussions)
예제 #4
0
파일: ajax.py 프로젝트: robsws/gdpgroup9
def getPresentationsThreads(request):
    presentationID = request.POST.get('presentationID', '')
    usr = -1
    if request.user.id:
        usr = request.user.id
    try:
    	discussions = api.getPresentationsThreads(int(presentationID), int(usr))
    	returnJSON = serializers.serialize('json', discussions, indent=4, extras=('__unicode__', 'isSubscribed'))
    except APIException as e:
    	response = dict(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')
예제 #5
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)
예제 #6
0
파일: tests.py 프로젝트: robsws/gdpgroup9
	def test_normal(self):
		#just checking for errors running
		api.getPresentationsThreads(PRESENTATION_ID, USER_ID)
		api.getPresentationsThreads(PRESENTATION_ID, -1)