import re import string from App.Dialogs import MessageDialog # Convert URL to a set of letters, numbers and underscores # (non-symbol characters) for use as a JavaScript variable name # based on quote() from urllib.pl def jsSafe(s,REQUEST): # shorten s = string.replace(s,REQUEST.SERVER_URL+'/','') # characters that should not be converted safe = string.letters + string.digits + '_' # quote the string res = list(s) for i in range(len(res)): c = res[i] if c not in safe: res[i] = '%%%02x' % ord(c) s_quoted = string.joinfields(res, '') # quote percent signs (%) s_quoted = string.replace(s_quoted,'%','_') return s_quoted # Replace blocks of spaces with 1 space, kill line breaks def cleanUp(renderCode): # kill comments = re.compile(r"