本文整理汇总了Python中modules.blankspace.remove_whitespaces函数的典型用法代码示例。如果您正苦于以下问题:Python remove_whitespaces函数的具体用法?Python remove_whitespaces怎么用?Python remove_whitespaces使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove_whitespaces函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: xmlrpc_updateOrg
def xmlrpc_updateOrg(self,queryParams,client_id):
'''
* Purpose:
- updating the orgdetails after edit organisation
* Input:
- [orgcode,orgaddress,orgcountry,orgstate,orgcity,orgpincode,orgtelno,orgfax,orgemail,
orgwebsite,orgmvat,orgstax,orgregno,orgregdate,orgfcrano,orgfcradate,orgpan],client_id
* Output:
- It will returns String "upadted successfully"
'''
queryParams = blankspace.remove_whitespaces(queryParams)
connection = dbconnect.engines[client_id].connect()
Session = dbconnect.session(bind=connection)
result = Session.query(dbconnect.Organisation).\
filter(dbconnect.Organisation.orgcode == queryParams[0]).\
update({'orgaddr': queryParams[1],'orgcountry':queryParams[2],'orgstate':queryParams[3],\
'orgcity': queryParams[4],'orgpincode':queryParams[5],'orgtelno':queryParams[6],\
'orgfax':queryParams[7],'orgemail':queryParams[8],'orgwebsite':queryParams[9],\
'orgmvat':queryParams[10],'orgstax':queryParams[11],'orgregno':queryParams[12],\
'orgregdate':queryParams[13],'orgfcrano':queryParams[14],'orgfcradate':queryParams[15],\
'orgpan':queryParams[16]})
Session.commit()
Session.close()
connection.connection.close()
return "upadted successfully"
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:28,代码来源:rpc_organisation.py
示例17: xmlrpc_deleteVoucher
def xmlrpc_deleteVoucher(self,queryParams,client_id):
"""
* Purpose:
- This function will not completely delete voucherdetails
but it will set the flag 0 instead 1
- so it will be like disabled for search voucher
* Input:
- [voucherno]
* Output:
- returns boolean True if deleted else False
"""
queryParams = blankspace.remove_whitespaces(queryParams)
try:
connection = dbconnect.engines[client_id].connect()
Session = dbconnect.session(bind=connection)
Session.query(dbconnect.VoucherMaster).\
filter(dbconnect.VoucherMaster.vouchercode == queryParams[0]).\
update({'flag':0})
Session.commit()
Session.close()
connection.connection.close()
return True
except:
return False
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:26,代码来源:rpc_transaction.py
示例18: xmlrpc_getPreferences
def xmlrpc_getPreferences(self,queryParams,client_id):
"""
* Purpose:
- finding the appropriate preferences for accountcode
for given flag no
- if flag no is ``2`` then will return
accountcode flag value.
- if flag no is ``1`` then will return rollover flag value
* Input:
- [flagno]
* Output:
- It returns list of flagname and set falg depend on flagno
- set flag is set to make it one time activity.
"""
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()
Session.close()
connection.connection.close()
if result == []:
return result
else:
print [result.flagname,result.set_flag]
return [result.flagname,result.set_flag]
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:28,代码来源:rpc_organisation.py
示例19: xmlrpc_Import
def xmlrpc_Import(self,queryParams):
"""
* Purpose:
- import database from /export directory to /opt/abt/db
and write org tags in /opt/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,"/opt/abt/abt.xml");
if(count != 0):
print "deleting the existing database"
os.system("rm -rf /opt/abt/db/"+queryParams[3])
#encrypt the database name
encrypted_db = blankspace.remove_whitespaces([queryParams[3].rstrip()])
#adding database with all data in db folder
os.system("sqlite3 /opt/abt/db/"+queryParams[3]+"< /opt/abt/export/"+encrypted_db[0])
if os.path.exists("$HOME/export/"):
os.system("/opt/abt/adb -e push $HOME/export/ /mnt/sdcard/export/")
else:
print"No file found"
return "success"
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:31,代码来源:rpc_main.py
示例20: xmlrpc_getGroupCodeByGroupName
def xmlrpc_getGroupCodeByGroupName(self,queryParams,client_id):
'''
* Purpose:
- function for extracting groupcpde of group based on groupname.
- query to retrive groupcode requested groupname by client.
* Input:
- groupname(datatype:text) , client_id(datatype:integer)
* Output:
- returns list containing groupcode 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.Groups).\
filter(dbconnect.Groups.groupname == queryParams[0]).\
first()
Session.close()
connection.connection.close()
if result != None:
return [result.groupcode]
else:
return []
开发者ID:ashwinishinde,项目名称:ABTcore-Ubuntu,代码行数:25,代码来源:rpc_groups.py
注:本文中的modules.blankspace.remove_whitespaces函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论