Exemple #1
0
 def raw(self, db, email, username, password):
     response = None
     result, fault = util.getResponseTemplates(False, False)
     if (util.checkNulls(fault, username, password, email)): return fault
     if (not util.checkUsername(username)):
         util.setFaultCodeAndMessage(fault, faults.INVALID_USERNAME,
                                     faults.INVALID_USERNAME_MESSAGE)
         return fault
     if (not util.checkEmail(email)):
         util.setFaultCodeAndMessage(fault, faults.INVALID_EMAIL,
                                     faults.INVALID_EMAIL_MESSAGE)
         return fault
     if (db.doesUsernameExist(username)):
         util.setFaultCodeAndMessage(fault, faults.USERNAME_EXISTS,
                                     faults.USERNAME_EXISTS_MESSAGE)
         response = fault
     elif (db.doesEmailExist(email)):
         util.setFaultCodeAndMessage(fault, faults.EMAIL_EXISTS,
                                     faults.EMAIL_EXISTS_MESSAGE)
         response = fault
     if (response): return response
     reg = db.registerUser(email, username, password)
     if (not reg):
         util.setFaultCodeAndMessage(fault, faults.DB_REGISTRATION_ERROR,
                                     faults.DB_REGISTRATION_ERROR_MESSAGE)
         response = fault
     else:
         util.setResult(result, True)
         response = result
     return response
Exemple #2
0
	def raw(self,db,email,username,password):
		response = None
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,username,password,email)): return fault
		if(not util.checkUsername(username)):
			util.setFaultCodeAndMessage(fault,faults.INVALID_USERNAME,faults.INVALID_USERNAME_MESSAGE)
			return fault
		if(not util.checkEmail(email)):
			util.setFaultCodeAndMessage(fault,faults.INVALID_EMAIL,faults.INVALID_EMAIL_MESSAGE)
			return fault
		if(db.doesUsernameExist(username)):
			util.setFaultCodeAndMessage(fault,faults.USERNAME_EXISTS,faults.USERNAME_EXISTS_MESSAGE)
			response = fault
		elif(db.doesEmailExist(email)):
			util.setFaultCodeAndMessage(fault,faults.EMAIL_EXISTS,faults.EMAIL_EXISTS_MESSAGE)
			response = fault
		if(response): return response
		reg = db.registerUser(email,username,password)
		if(not reg):
			util.setFaultCodeAndMessage(fault,faults.DB_REGISTRATION_ERROR,faults.DB_REGISTRATION_ERROR_MESSAGE)
			response = fault
		else:
			util.setResult(result,True)
			response = result
		return response
Exemple #3
0
	def raw(self,db,stickers):
		response = None
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,stickers)): return fault
		res = db.uploadStickers(stickers)
		if(not res):
			util.setFaultCodeAndMessage(fault,faults.STICKER_UPLOAD_ERROR,faults.STICKER_UPLOAD_ERROR_MESSAGE)
			return fault
		util.setResult(result,True)
		return result
Exemple #4
0
 def raw(self, db, stickers):
     response = None
     result, fault = util.getResponseTemplates(False, False)
     if (util.checkNulls(fault, stickers)): return fault
     res = db.uploadStickers(stickers)
     if (not res):
         util.setFaultCodeAndMessage(fault, faults.STICKER_UPLOAD_ERROR,
                                     faults.STICKER_UPLOAD_ERROR_MESSAGE)
         return fault
     util.setResult(result, True)
     return result
Exemple #5
0
	def raw(self,db,query,offset,limit):
		response = None
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,query,offset,limit)): return fault
		se,totalRows = db.searchWithTotalRows(query,offset,limit)
		if(not se):
			util.setFaultCodeAndMessage(fault,faults.DB_SEARCH_ERROR,faults.DB_SEARCH_ERROR_MESSAGE)
			response = fault
		else:
			util.setResultWithDataAndTotalRows(result,True,se,totalRows)
			response = result
		return response
Exemple #6
0
	def raw(self,db,username,password,newPassword):
		response = None
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,username,password,newPassword)): return fault
		cp = db.changePassword(username,password,newPassword)
		if(not cp):
			util.setFaultCodeAndMessage(fault,faults.DB_CHANGE_PASSWORD_ERROR,faults.DB_CHANGE_PASSWORD_ERROR_MESSAGE)
			response = fault
		else:
			util.setResult(result,True)
			response = result
		return response
Exemple #7
0
	def raw(self,db,email,username,password):
		response = None
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,username,password,email)): return fault
		unreg = db.unregisterUser(email,username,password)
		if(not unreg):
			util.setFaultCodeAndMessage(fault,faults.DB_UNREGISTER_ERROR,faults.DB_UNREGISTER_ERROR_MESSAGE)
			response = fault
		else:
			util.setResult(result,True)
			response = result
		return response
Exemple #8
0
	def raw(self,db,username):
		response = None
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,username)): return fault
		data = db.getProfileInfo(username)
		if(not data):
			util.setFaultCodeAndMessage(fault,faults.PROFILE_INFO_ERROR,faults.PROFILE_INFO_ERROR_MESSAGE)
			response = fault
		else:
			util.setResultWithData(result,True,data)
			response = result
		return response
Exemple #9
0
	def raw(self,db,username,offset,limit):
		response = None
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,username)): return fault
		data,totalRows = db.getTagsForUserWithTotalRows(username,offset,limit)
		if(not data):
			util.setFaultCodeAndMessage(fault,faults.TAGS_ERROR,faults.TAGS_ERROR_MESSAGE)
			response = fault
		else:
			util.setResultWithDataAndTotalRows(result,True,data,totalRows)
			response = result
		return response
Exemple #10
0
	def raw(self,db,tagId,username,password):
		response = None
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,tagId,username,password)): return fault
		dt = db.deleteTag(tagId,username,password)
		if(not dt):
			util.setFaultCodeAndMessage(fault,faults.DELETE_TAG_ERROR,faults.DELETE_TAG_ERROR_MESSAGE)
			response = fault
		else:
			util.setResult(result,True)
			response = result
		return response
Exemple #11
0
	def raw(self,db,latitude,longitude,offset,limit):
		response = None
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,latitude,longitude,offset,limit)): return fault
		data,totalRows = db.getARNearbyWithTotalRows(latitude,longitude,offset,limit)
		if(not data):
			util.setFaultCodeAndMessage(fault,faults.NEARBY_ERROR,faults.NEARBY_ERROR_MESSAGE)
			response = fault
		else:
			util.setResultWithDataAndTotalRows(result,True,data,totalRows)
			response = result
		return response
Exemple #12
0
 def raw(self, db, tagId, username, password):
     response = None
     result, fault = util.getResponseTemplates(False, False)
     if (util.checkNulls(fault, tagId, username, password)): return fault
     dt = db.deleteTag(tagId, username, password)
     if (not dt):
         util.setFaultCodeAndMessage(fault, faults.DELETE_TAG_ERROR,
                                     faults.DELETE_TAG_ERROR_MESSAGE)
         response = fault
     else:
         util.setResult(result, True)
         response = result
     return response
Exemple #13
0
 def raw(self, db, offset, limit):
     response = None
     result, fault = util.getResponseTemplates(False, False)
     if (util.checkNulls(fault, offset, limit)): return fault
     data, totalRows = db.getTagsByRatingWithTotalRows(offset, limit)
     if (not data):
         util.setFaultCodeAndMessage(fault, faults.NEARBY_ERROR,
                                     faults.NEARBY_ERROR_MESSAGE)
         response = fault
     else:
         util.setResultWithDataAndTotalRows(result, True, data, totalRows)
         response = result
     return response
Exemple #14
0
	def raw(self,db,tagId,rating):
		response = None
		tagId = int(tagId)
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,tagId)): return fault
		rated = db.rateTag(tagId,rating)
		if(not rated):
			util.setFaultCodeAndMessage(fault,faults.RATING_ERROR,faults.RATING_ERROR_MESSAGE)
			response = fault
		else:
			util.setResult(result,True)
			response = result
		return response
Exemple #15
0
	def raw(self,db,username,password):
		response = None
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,username,password)): return fault
		auth = db.authenticate(username,password)
		if(not auth):
			util.setFaultCodeAndMessage(fault,faults.AUTH_ERROR,faults.AUTH_ERROR_MESSAGE)
			response = fault;
		else:
			util.setResult(result,True)
			result['id'] = auth['id']
			response = result
		return response
Exemple #16
0
 def raw(self, db, username):
     response = None
     result, fault = util.getResponseTemplates(False, False)
     if (util.checkNulls(fault, username)): return fault
     data = db.getProfileInfo(username)
     if (not data):
         util.setFaultCodeAndMessage(fault, faults.PROFILE_INFO_ERROR,
                                     faults.PROFILE_INFO_ERROR_MESSAGE)
         response = fault
     else:
         util.setResultWithData(result, True, data)
         response = result
     return response
Exemple #17
0
 def raw(self, db, query, offset, limit):
     response = None
     result, fault = util.getResponseTemplates(False, False)
     if (util.checkNulls(fault, query, offset, limit)): return fault
     se, totalRows = db.searchWithTotalRows(query, offset, limit)
     if (not se):
         util.setFaultCodeAndMessage(fault, faults.DB_SEARCH_ERROR,
                                     faults.DB_SEARCH_ERROR_MESSAGE)
         response = fault
     else:
         util.setResultWithDataAndTotalRows(result, True, se, totalRows)
         response = result
     return response
Exemple #18
0
	def raw(self,db,username,password,latitude,longitude,orientation,filename,thumbFilename,filetype,thoroughfare,subThoroughfare,locality,subLocality,adminArea,subAdminArea,postalcode,country):
		response = None
		result,fault = util.getResponseTemplates(False,False)
		if(util.checkNulls(fault,username,password,latitude,longitude,orientation,filename,thumbFilename,filetype)): return fault
		published = db.publishTag(username,password,latitude,longitude,orientation,filename,thumbFilename,thoroughfare,subThoroughfare,locality,subLocality,adminArea,subAdminArea,postalcode,country)
		if(not published):
			util.setFaultCodeAndMessage(fault,faults.PUBLISH_ERROR,faults.PUBLISH_ERROR_MESSAGE)
			response = fault
		else:
			util.setResult(result,True)
			result['large'] = filename
			response = result
		return response
Exemple #19
0
 def raw(self, db, email, username, password):
     response = None
     result, fault = util.getResponseTemplates(False, False)
     if (util.checkNulls(fault, username, password, email)): return fault
     unreg = db.unregisterUser(email, username, password)
     if (not unreg):
         util.setFaultCodeAndMessage(fault, faults.DB_UNREGISTER_ERROR,
                                     faults.DB_UNREGISTER_ERROR_MESSAGE)
         response = fault
     else:
         util.setResult(result, True)
         response = result
     return response
Exemple #20
0
 def raw(self, db, username, password):
     response = None
     result, fault = util.getResponseTemplates(False, False)
     if (util.checkNulls(fault, username, password)): return fault
     auth = db.authenticate(username, password)
     if (not auth):
         util.setFaultCodeAndMessage(fault, faults.AUTH_ERROR,
                                     faults.AUTH_ERROR_MESSAGE)
         response = fault
     else:
         util.setResult(result, True)
         result['id'] = auth['id']
         response = result
     return response
Exemple #21
0
 def raw(self, db, tagId, rating):
     response = None
     tagId = int(tagId)
     result, fault = util.getResponseTemplates(False, False)
     if (util.checkNulls(fault, tagId)): return fault
     rated = db.rateTag(tagId, rating)
     if (not rated):
         util.setFaultCodeAndMessage(fault, faults.RATING_ERROR,
                                     faults.RATING_ERROR_MESSAGE)
         response = fault
     else:
         util.setResult(result, True)
         response = result
     return response
Exemple #22
0
 def raw(self, db, username, password, newPassword):
     response = None
     result, fault = util.getResponseTemplates(False, False)
     if (util.checkNulls(fault, username, password, newPassword)):
         return fault
     cp = db.changePassword(username, password, newPassword)
     if (not cp):
         util.setFaultCodeAndMessage(
             fault, faults.DB_CHANGE_PASSWORD_ERROR,
             faults.DB_CHANGE_PASSWORD_ERROR_MESSAGE)
         response = fault
     else:
         util.setResult(result, True)
         response = result
     return response
Exemple #23
0
 def raw(self, db, username, password, latitude, longitude, orientation,
         uploadedFile, uploadedThumbFile, filetype, thoroughfare,
         subThoroughfare, locality, subLocality, adminArea, subAdminArea,
         postalcode, country):
     response = None
     result, fault = util.getResponseTemplates(False, False)
     return fault
     if (util.checkNulls(fault, username, password, latitude, longitude,
                         orientation, uploadedFile, uploadedThumbFile,
                         filetype)):
         return fault
     photoFileLocation = util.upload(uploadedFile, filetype)
     thumbFileLocation = util.upload(uploadedThumbFile, filetype)
     if (not photoFileLocation):
         util.setFaultCodeAndMessage(fault, faults.UPLOAD_ERROR,
                                     faults.UPLOAD_ERROR_MESSAGE)
         return fault
     if (not thumbFileLocation):
         util.setFaultCodeAndMessage(fault, faults.UPLOAD_ERROR,
                                     faults.UPLOAD_ERROR_MESSAGE)
         return fault
     published = db.publishTag(username, password, latitude, longitude,
                               orientation, photoFileLocation,
                               thumbFileLocation, thoroughfare,
                               subThoroughfare, locality, subLocality,
                               adminArea, subAdminArea, postalcode, country)
     if (not published):
         util.setFaultCodeAndMessage(fault, faults.PUBLISH_ERROR,
                                     faults.PUBLISH_ERROR_MESSAGE)
         response = fault
     else:
         util.setResult(result, True)
         result['large'] = photoFileLocation
         response = result
     return response