Ejemplo n.º 1
0
	def CommentStateChange(self,CommentID,by,ip,RequestedOperation=SYSTEM_PERMISSION_UPDATE,PreviousState=-1):
		try:
			if PreviousState == -1:
				CommentObj = Comment.objects.get(id=CommentID)
				if CommentObj is None:
					error_msg = 'Invalid CommentID'
					self.CommunicationLogger.error('[%s] == Error == \n %s'%('CommentStateChange',error_msg))
					return (-1,error_msg)
				PreviousState =  CommentObj.State
			StateID = getStateIDbyStateName(StateName)
			if StateID == -1:
				error_msg = 'Invalid StateName %s ' % (StateName)
				self.CommunicationLogger.error('[%s] == Error == \n %s'%('CommentStateChange',error_msg))
				return (-1,error_msg)
			details = {
					'CommentID':CommentID,
					'LogsDesc': 'PrState ' + str(PreviousState),
					'op':RequestedOperation,
					'by':by,
					'ip':ip,
				}
			res = DBStateChangeComment(details)
			return res
		except:
			error_message = 'Error @ CommentStateChange in Business Functions'
			self.CommunicationLogger.exception('[%s] == Exception =='%('AddComment'))
			return (-5,error_msg)
Ejemplo n.º 2
0
	def AddComment(self,_AppLabel,_Model,RecordID,UserID,CommentText,by,ip,RequestedOperation=SYSTEM_PERMISSION_INSERT):
		try:
			ctid = getContentTypesByAppNameAndModel(_AppLabel,_Model)
			if ctid == -1:
				error_msg = 'Invalid Applabel %s or Model %s' % (_AppLabel, _Model)
				self.CommunicationLogger.error('[%s] == Error == \n %s'%('AddComment',error_msg))
				return (-1,error_msg)
			StateID = getStateIDbyStateName(StateName)
			if StateID == -1:
				error_msg = 'Invalid StateName %s ' % (StateName)
				self.CommunicationLogger.error('[%s] == Error == \n %s'%('AddComment',error_msg))
				return (-1,error_msg)
			details = {
					'ContentType':ctid,
					'RecordID':RecordID,
					'UserID':UserID,
					'CommentText':CommentText,
					'op':RequestedOperation,
					'by':by,
					'ip':ip,
				}
			res = DBInsertComment(details)
			return res
		except:
			error_msg = 'Error @ AddComment in Business Functions'
			self.CommunicationLogger.exception('[%s] == Exception =='%('AddComment'))
			return (-5,error_msg)