str() -> unicode()

This commit is contained in:
Miroslav Stampar
2010-05-28 13:05:02 +00:00
parent f24187f251
commit a3db3c03c1
17 changed files with 31 additions and 31 deletions

View File

@@ -451,7 +451,7 @@ def readInput(message, default=None):
message += "\n> "
if conf.batch and default:
infoMsg = "%s%s" % (message, str(default))
infoMsg = "%s%s" % (message, unicode(default))
logger.info(infoMsg)
debugMsg = "used the default behaviour, running in batch mode"
@@ -517,7 +517,7 @@ def sanitizeStr(inpStr):
@rtype: C{str}
"""
cleanString = str(inpStr)
cleanString = unicode(inpStr)
cleanString = cleanString.replace("\n", " ").replace("\r", "")
return cleanString
@@ -638,8 +638,8 @@ def parseTargetDirect():
conf.dbmsUser = details.group('user')
conf.dbmsPass = details.group('pass')
else:
conf.dbmsUser = str()
conf.dbmsPass = str()
conf.dbmsUser = unicode()
conf.dbmsPass = unicode()
if not conf.dbmsPass:
conf.dbmsPass = None
@@ -1032,7 +1032,7 @@ def safeStringFormat(formatStr, params):
if index != -1:
if count < len(params):
retVal = retVal[:index] + str(params[count]) + retVal[index+2:]
retVal = retVal[:index] + unicode(params[count]) + retVal[index+2:]
else:
raise sqlmapNoneDataException, "wrong number of parameters during string formatting"
count += 1
@@ -1107,7 +1107,7 @@ def profile(profileOutputFile=None, dotOutputFile=None, imageOutputFile=None):
import gtk
import pydot
except ImportError, e:
errMsg = "profiling requires third-party libraries (%s)" % str(e)
errMsg = "profiling requires third-party libraries (%s)" % unicode(e)
logger.error(errMsg)
return
@@ -1343,7 +1343,7 @@ def getCommonStart(strings=[]):
if len(strings) == 1:
return strings[0]
retVal = str()
retVal = unicode()
maxCount = min(len(string) for string in strings)
count = 0

View File

@@ -63,7 +63,7 @@ class Dump:
return
data = str(data)
data = unicode(data)
if data:
data = data.replace("__NEWLINE__", "\n").replace("__TAB__", "\t")
@@ -93,7 +93,7 @@ class Dump:
if isinstance(element, basestring):
self.__write("[*] %s" % element)
elif isinstance(element, (list, tuple, set)):
self.__write("[*] " + ", ".join(str(e) for e in element))
self.__write("[*] " + ", ".join(unicode(e) for e in element))
if elements:
self.__write("")

View File

@@ -80,7 +80,7 @@ class ProgressBar:
" " * (allFull - numHashes))
# Add the percentage at the beginning of the progress bar
percentString = str(percentDone) + "%"
percentString = unicode(percentDone) + "%"
self.__progBar = "%s %s" % (percentString, self.__progBar)
def draw(self, eta=0):
@@ -102,4 +102,4 @@ class ProgressBar:
This method returns the progress bar string
"""
return str(self.__progBar)
return unicode(self.__progBar)

View File

@@ -214,7 +214,7 @@ def __updateSqlmap():
logger.debug(debugMsg)
def notify(event_dict):
action = str(event_dict['action'])
action = unicode(event_dict['action'])
index = action.find('_')
prefix = action[index + 1].upper() if index != -1 else action.capitalize()
@@ -224,7 +224,7 @@ def __updateSqlmap():
if action.find('_completed') == -1:
print "%s\t%s" % (prefix, event_dict['path'])
else:
revision = str(event_dict['revision'])
revision = unicode(event_dict['revision'])
index = revision.find('number ')
if index != -1: