Example #1
0
	def create(self):
		try:
			#hash password
			self.pwd=User._get_password_hash(self.pwd)

			#connect to db
			SerialDoc.connectdb()

			#save
			self.save()

			return self

		except Exception as e:
			return None
Example #2
0
	def authenticate(self,uname,pwd):	
		try:
			#connect to db
			SerialDoc.connectdb()

			#find user
			user=User.objects.get(name=uname,
					      pwd=User._get_password_hash(pwd))

			print repr(user)

			if user==None:
				return None

			return user

		except Exception as e:
			return None
Example #3
0
	def create(self):
		try:
			#status
			self.status=MLCase.STATUS_DRAFT

			#uuid
			self.uuid=MLCase._get_guid()

			#connect to db
			SerialDoc.connectdb()

			#save
			self.save()

			return self

		except Exception as e:
			Logger.getlogger("test").info(e)
			return None