-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutility.py
42 lines (36 loc) · 1.25 KB
/
utility.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import logging
import sys
class Utility():
@staticmethod
def getText(node):
try:
rc = []
node = node[0]
for node in node.childNodes:
if node.nodeType == node.TEXT_NODE:
rc.append(node.data)
except:
logging.info(sys.exc_info())
return ''.join(rc)
@staticmethod
def makeBrowserFriendly(str):
str = str.replace('<','<').replace('>','>')
str += '<br/><br/>'
return str
@staticmethod
def getCredentialsObject(requestParams):
return {
'email': requestParams.get('email'),
'password': requestParams.get('password'),
'account_id': requestParams.get('account_id'),
'is_sandbox': requestParams.get('is_sandbox'),
'role_id': requestParams.get('role_id'),
'webservice_url': requestParams.get('webservice_url','') + '/services/NetSuitePort_2013_2'
}
@staticmethod
def getFilePermissionHash(fileId, credObject):
return str(fileId)
+ credObject.get('email')
+ credObject.get('role_id')
+ credObject.get('account_id')
+ credObject.get('is_sandbox')