当前位置: 首页>>代码示例>>Python>>正文


Python blankspace.remove_whitespaces函数代码示例

本文整理汇总了Python中modules.blankspace.remove_whitespaces函数的典型用法代码示例。如果您正苦于以下问题:Python remove_whitespaces函数的具体用法?Python remove_whitespaces怎么用?Python remove_whitespaces使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了remove_whitespaces函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: xmlrpc_isUserExist

	def xmlrpc_isUserExist(self,queryParams,client_id):
		'''
		* Purpose: 
			- function to check for valid password and userrole and
			  username 
			  
		* Input:
			- [username , password , userrole]
		* Output:
			- if username, password and userole is valid then
			  return ``True`` else return ``False``
		'''
		queryParams = blankspace.remove_whitespaces(queryParams)
		print queryParams
		connection = dbconnect.engines[client_id].connect()
		Session = dbconnect.session(bind=connection)
		password = blankspace.remove_whitespaces([queryParams[1].encode('base64').rstrip()])
		result = Session.query(dbconnect.Users).filter(dbconnect.Users.username == queryParams[0]).\
							filter(dbconnect.Users.userpassword == password[0]).\
							filter(dbconnect.Users.userrole == queryParams[2]).first()			
		Session.close()
		connection.connection.close()
	
		if result == None:
			return False
		else:	
			return True
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:27,代码来源:rpc_user.py

示例2: xmlrpc_changeUserName

	def xmlrpc_changeUserName(self,queryParams,client_id):
		'''
		* Purpose:
			- It will facilitate user to change username 
			  based on there old_username and password 
		* Input: 
			- [old_username,new_username,password,userrole]
			
		* Output:
		        - return ``False`` if given user is not present with old_password,userrole
                          else it update username and return ``True`` 
		
		'''
		connection = dbconnect.engines[client_id].connect()
		Session = dbconnect.session(bind=connection)
                queryParams = blankspace.remove_whitespaces(queryParams)
                password = blankspace.remove_whitespaces([queryParams[2].encode('base64').rstrip()])
                result = Session.query(dbconnect.Users.userid).filter(dbconnect.Users.username == queryParams[0]).\
                                                       filter(dbconnect.Users.userpassword == password[0]).\
                                                       filter(dbconnect.Users.userrole == queryParams[3]).first()
                
                if result == None:
                	Session.close()
               		connection.connection.close()
               		return False
               	else:
               		
                        result = Session.query(dbconnect.Users).filter(dbconnect.Users.userid == result.userid).\
               		 					update({'username':queryParams[1]})
               
               		Session.commit()
              		Session.close()
               		connection.connection.close()
               		return True                               
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:34,代码来源:rpc_user.py

示例3: xmlrpc_Import

	def xmlrpc_Import(self,queryParams):
		"""
		* Purpose:
			- import database from /export directory to /ABT/abt/db 
			  and write org tags in /ABT/abt/abt.xml file
			
		* Input: 
		 	- qureyParams:[organisationName,financialFrom,financialTo,database,rollover_flag]
		 	
		* Output:
			- import database and write org tags in xml file
		"""
		#print "queryParams"
		#writting to xml file
		count = self.xmlrpc_writeToXmlFile(queryParams,"/ABT/abt/abt.xml");
		
		if(count != 0):
			#print "deleting the existing database"
			os.unlink("/ABT/abt/db/"+queryParams[3])
			#print "import"
		#encrypt the database name
		encrypted_db = blankspace.remove_whitespaces([queryParams[3].encode('base64').rstrip()])
		#adding database with all data in db folder
		#os.chdir("/ABT/abt/export/")
		connection = dbconnect.engines[self.client_id].raw_connection()
		self.restore_db(connection, db_file="C:/ABT/abt/db/"+queryParams[3], filename= "C:/ABT/abt/export/"+encrypted_db[0]+".sql")
		#os.system("sqlite3 /ABT/abt/db/"+queryParams[3]+"< /ABT/abt/export/"+encrypted_db[0])
		if os.path.exists("/ABT/abt/export/"):

			os.system("adb -e push C:/ABT/abt/export /mnt/sdcard/export/")
		else:
			print"No file found" 
		return "success"
开发者ID:ashwinishinde,项目名称:ABTcore-Windows,代码行数:33,代码来源:rpc_main.py

示例4: xmlrpc_subgroupExists

	def xmlrpc_subgroupExists(self,queryParams,client_id):	
		'''
		* Purpose:
			- checks if the new subgroup typed by the user already exists.
			- This will validate and prevent any duplication.
			- The function takes queryParams as its parameter and contains one element, 
			  the subgroupname as string.
		
		* Input:
			- subgroupname(datatype:text)
		
		* Output:
			- returns ``1`` if the subgroup exists else ``0``.
		'''
		queryParams = blankspace.remove_whitespaces(queryParams)	
		connection = dbconnect.engines[client_id].connect()
		Session = dbconnect.session(bind=connection)
		result = Session.query(func.count(dbconnect.subGroups.subgroupname)).\
		      filter((func.lower(dbconnect.subGroups.subgroupname)) == queryParams[0].lower()).scalar()
		Session.close()
		connection.connection.close()
	
		if result == 0:
			return "0"
		else:
			return "1"
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:26,代码来源:rpc_groups.py

示例5: xmlrpc_setSubGroup

	def xmlrpc_setSubGroup(self,queryParams,client_id):
		'''
		* Purpose:
			- used ``subGroups`` table to query .
			- function for adding new subgroups in table subgroups
			
		* Input: 	
			- groupname(datatype:text), subgroupname(datatype:text) , client_id (datatype:integer)
			
		* Output: 
			- returns 1 when successful, 0 when subgroupname(datatype:text) is null
		  	- When successful it returns 1 otherwise it returns 0. 
		'''
		queryParams = blankspace.remove_whitespaces(queryParams)
		# call getGroupCodeByGroupName func to get groupcode
		result = self.xmlrpc_getGroupCodeByGroupName([queryParams[0]],client_id) 
		# call getSubGroupCodeBySubGroupName fun to get subgroupcode
		#result = self.xmlrpc_getSubGroupCodeBySubGroupName([queryParams[1]],client_id) 
		if result != None:
			group_code = result[0]
			#print group_code
			connection = dbconnect.engines[client_id].connect()
                	Session = dbconnect.session(bind=connection)
                	Session.add_all([dbconnect.subGroups(group_code,queryParams[1])])
                	Session.commit()
                	Session.close()
                	connection.connection.close()
                	if queryParams[1]=="null":
				return "0"
			else:
				return "1"
                else:
			return []
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:33,代码来源:rpc_groups.py

示例6: xmlrpc_getSubGroupCodeByAccountName

	def xmlrpc_getSubGroupCodeByAccountName(self,queryParams,client_id):
		'''
		* Purpose:
			- function for extracting subgroup code of group based on accountname
			- query the account table to retrive subgroupcode for reqested accountname 
			
		* Input:
			- accountname(datatype:text),client_id(datatype:integer)
			
		* Output:
			- returns list containing subgroupcode if its not None else will return false.
			
		'''
		queryParams = blankspace.remove_whitespaces(queryParams)
		connection = dbconnect.engines[client_id].connect()
		Session = dbconnect.session(bind=connection)
		result = Session.query(dbconnect.Account).\
		      filter(dbconnect.Account.accountname == queryParams[0]).\
		      first()
		Session.close()
		connection.connection.close()
		if result != None:
			return [result.subgroupcode]
		else:
			return []
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:25,代码来源:rpc_groups.py

示例7: xmlrpc_accountExists

	def xmlrpc_accountExists(self, queryParams, client_id):
		"""
		* Purpose:
			- function for finding if an account already exists 
			  with the supplied name. 	
			- queryParams which is a list containing one element, 
			  accountname as string.
			- querys the account table and sees if an account 
			  name similar to one provided as a parameter exists.
			- We can ensure that no duplicate account is ever entered because 
			  if a similar account exists. 
			- like the one in queryparams[0] then we won't allow another 
			  entry with same name.
		  
		* Output:
			- if account name exists returns 1 else 0 .
		"""
		queryParams = blankspace.remove_whitespaces(queryParams)
		connection = dbconnect.engines[client_id].connect()
		Session = dbconnect.session(bind=connection)
		result = Session.query(func.count(dbconnect.Account.accountname)).\
		      filter((func.lower(dbconnect.Account.accountname)) == queryParams[0].lower()).\
		      scalar()
		      
		Session.commit()
		Session.close()
		connection.connection.close()
		
		if result == 0:
			return "0"
		else:
			return "1"
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:32,代码来源:rpc_account.py

示例8: xmlrpc_chequeNoExist

	def xmlrpc_chequeNoExist(self, queryParams, client_id):
		"""
		* Purpose:
			- Function for finding if an cheque_no already 
			  exists with the supplied code.
		  
		* Input:
			- cheque_no (datatype:string)
		
		* Output:
			- return "1" if cheque_no exists and "0" if not.
		
		"""
		queryParams = blankspace.remove_whitespaces(queryParams)
		connection = dbconnect.engines[client_id].connect()
		Session = dbconnect.session(bind=connection)
		result = Session.query(func.count(dbconnect.VoucherMaster.cheque_no)).\
		      filter(dbconnect.VoucherMaster.cheque_no == queryParams[0]).\
		      scalar()
		Session.close()
		connection.connection.close()
		if result == 0:
			return "0"
		else:
			return "1"
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:25,代码来源:rpc_transaction.py

示例9: xmlrpc_getorgTypeByname

	def xmlrpc_getorgTypeByname(self, queryParams, client_id):   
		'''
		* Purpose:
			- function for get Organisation Type for provided organisation
			- querys the Organisation table and sees if an orgname
			  similar to one provided as a parameter.
			- if it exists then it will return orgtype related orgname
			
		* Input: 
			- [orgname(datatype:string)]
			
		* Output: 
			- returns orgtype if orgname match else return false string
		'''
		
		queryParams = blankspace.remove_whitespaces(queryParams)
		connection = dbconnect.engines[client_id].connect()
	        Session = dbconnect.session(bind=connection)
	        result = Session.query(dbconnect.Organisation).\
	           		 filter(dbconnect.Organisation.orgname == queryParams[0]).\
	               		 first()
		Session.close()
	        connection.connection.close()
		print "getorgtype"
		print result.orgtype
		if result == None:
		    return "0"   
		else:
		    return result.orgtype
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:29,代码来源:rpc_organisation.py

示例10: xmlrpc_setOrganisation

	def xmlrpc_setOrganisation(self,queryParams,client_id):
		"""
		* Purpose:
			- function for add organisation details in database
		
		* Input:
			- if orgtype is ``NGO`` then	
				[orgname,orgtype,orgcountry,orgstate,orgcity,orgaddr,orgpincode,
				orgtelno, orgfax, orgwebsite, orgemail, orgpan, "", "",
				orgregno, orgregdate, orgfcrano, orgfcradate]
			- else:
				[orgname,orgtype,orgcountry,orgstate,orgcity,orgaddr,orgpincode,
				orgtelno, orgfax, orgwebsite, orgemail, orgpan,orgmvat,orgstax,
				"", "", "", ""]
		* Output: 
			- returns boolean True if added successfully else False
		"""
		queryParams = blankspace.remove_whitespaces(queryParams)
		connection = dbconnect.engines[client_id].connect()
		Session = dbconnect.session(bind=connection)
		Session.add_all([\
				dbconnect.Organisation(\
					queryParams[0],queryParams[1],queryParams[2],queryParams[3],\
					queryParams[4],queryParams[5],queryParams[6],queryParams[7],\
					queryParams[8],queryParams[9],queryParams[10],queryParams[11],\
					queryParams[12],queryParams[13],queryParams[14],\
					queryParams[15],queryParams[16],queryParams[17])\
				])
		
		Session.commit()
		Session.close()
		connection.connection.close()
		return True 
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:33,代码来源:rpc_organisation.py

示例11: xmlrpc_editProject

	def xmlrpc_editProject(self, queryParams, client_id):
		"""
		* Purpose:
			- function for edit projectname
			- it will alter projectname ans update it.
			
		* Input:
			- [projectcode,projectname] 
				
		* Output: 
			- return string ``updated successfully``
		"""
		queryParams = blankspace.remove_whitespaces(queryParams)
		transaction = rpc_transaction.transaction()
		connection = dbconnect.engines[client_id].connect()
		Session = dbconnect.session(bind=connection)
		result = Session.query(dbconnect.Projects).\
			filter(dbconnect.Projects.projectcode == queryParams[0]).\
			update({'projectname': queryParams[1]})
		
		Session.commit()
		Session.close()
		connection.connection.close()
		
		return "upadted successfully"	
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:25,代码来源:rpc_organisation.py

示例12: xmlrpc_getPreferences

	def xmlrpc_getPreferences(self,queryParams,client_id):
		"""
		Purpose: Finding the appropriate preferences 
			 if flag no is "2" then will return
			 accountcode flag value.
			 If flag no is "1" then will return 
			 refeno flag value
			 
		Input: queryParams[flagname]
		
		Output: It returns flagno depnd on flagname

		"""
		queryParams = blankspace.remove_whitespaces(queryParams)
		connection = dbconnect.engines[client_id].connect()
		Session = dbconnect.session(bind=connection)
		result = Session.query(dbconnect.Flags).\
				filter(dbconnect.Flags.flagno == queryParams[0]).\
				first()
		
		if result == []:
			return result
		else:
			return result.flagname
		
		Session.close()
		connection.connection.close()
开发者ID:androportal,项目名称:ABTcore,代码行数:27,代码来源:rpc_organisation.py

示例13: xmlrpc_setPreferences

	def xmlrpc_setPreferences(self,queryParams,client_id):
		"""
		Purpose: function for update flags for project
		         ,manually created account code and voucher
		         reference number i/p parameters: Flag
		         No(datatype:integer) , FlagName
		         (datatype:text) o/p parameter : True

		Description : if flag no is "2" then will update
				accountcode flag value as either
				"manually" or "automatic"(default) if
				flag no is "1" then will update refeno
				flag value as either "mandatory" or
				"optional"
		"""
		queryParams = blankspace.remove_whitespaces(queryParams)
		connection = dbconnect.engines[client_id].connect()
		Session = dbconnect.session(bind=connection)
		Session.query(dbconnect.Flags).\
			filter(dbconnect.Flags.flagno == queryParams[0]).\
			update({'flagname':queryParams[1]})
		Session.commit()
		Session.close()
		connection.connection.close()
		return True
开发者ID:androportal,项目名称:ABTcore,代码行数:25,代码来源:rpc_organisation.py

示例14: xmlrpc_getVoucherDetails

	def xmlrpc_getVoucherDetails(self,queryParams,client_id):
	
		"""
		purpose: gets the transaction related details given a vouchercode.
		'''
		Input parameters : [voucher_code]
		'''
		returns  2 dimentional list containing rows with 3 columns.
		takes one parameter vouchercode+
		'''
		Output Parameters : [accountname,typeflag,amount]
		'''
		"""
		queryParams = blankspace.remove_whitespaces(queryParams)
		statement = "select account_name,typeflag,amount\
			     		from view_voucherbook\
			     		where vouchercode = '"+str(queryParams[0])+"'\
			     		and flag = 1 "
			     		
		result = dbconnect.engines[client_id].execute(statement).fetchall()
		
		voucherdetails = []
		if result == None:
			return []
		else:
			for row in result:
				voucherdetails.append([row[0],row[1],'%.2f'%float(row[2])])
		print voucherdetails		
		return voucherdetails
开发者ID:androportal,项目名称:ABTcore,代码行数:29,代码来源:rpc_transaction.py

示例15: xmlrpc_getVoucherDetails

	def xmlrpc_getVoucherDetails(self,queryParams,client_id):
		"""
		* Purpose:
			- gets the transaction related details given a vouchercode.  

		* Input:
			- [voucherno]

		* Output:
			- returns 2 dimentional list containing rows with 3 columns. 
			- [accountname,typeflag,amount]e,typeflag,amount] 

		"""
		queryParams = blankspace.remove_whitespaces(queryParams)
		statement = 'select account_name,typeflag,amount,cheque_no\
			     		from view_voucherbook\
			     		where vouchercode = "'+str(queryParams[0])+'"\
			     		and flag = 1 '
			     		
		result = dbconnect.engines[client_id].execute(statement).fetchall()
		
		voucherdetails = []
		if result == None:
			return []
		else:
			for row in result:
				if row[3] == None:
		
					voucherdetails.append([row[0],row[1],'%.2f'%float(row[2]),""])
				else:
					voucherdetails.append([row[0],row[1],'%.2f'%float(row[2]),row[3]])
		
		return voucherdetails
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:33,代码来源:rpc_transaction.py


注:本文中的modules.blankspace.remove_whitespaces函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。