def UrlToMergeD3(): callingUrl = ModedUrl("") #sys.stderr.write("UrlToMergeD3 callingUrl=%s\n"%(callingUrl)) htbinIdx = callingUrl.find(htbinPrefixScript) urlWithoutHost = callingUrl[htbinIdx:] #sys.stderr.write("UrlToMergeD3 urlWithoutHost=%s\n"%(urlWithoutHost)) # Consider lib_client.py # Maybe this URL is already a merge of B64-encoded URLs: htbinPrefixMergeScript = "/survol/merge_scripts.py" if urlWithoutHost.startswith(htbinPrefixMergeScript): # If so, no need to re-encode. urlWithoutHostB64 = urlWithoutHost[len(htbinPrefixMergeScript):] else: # This works on Windows with cgiserver.py just because the full script starts with "/survol" # urlWithoutHostB64 = "?url=" + lib_util.Base64Encode(urlWithoutHost) # Complete URL with the host. This is necessary because index.htm has no idea # of where the useful part of the URL starts. # This works on Linux with Apache. urlWithoutHostB64 = "?url=" + lib_util.Base64Encode(callingUrl) #sys.stderr.write("UrlToMergeD3 urlWithoutHostB64=%s\n"%urlWithoutHostB64) scriptD3Url = UrlWWW("index.htm") + urlWithoutHostB64 #sys.stderr.write("UrlToMergeD3 scriptD3Url=%s\n"%scriptD3Url) return scriptD3Url
def ClassUri(self, class_name, file=""): # The URL should never contain the chars "<" or ">". class_name = lib_util.Base64Encode(class_name) return self.UriMakeFromDict("class", { "Name": class_name, "File": lib_util.EncodeUri(file) })
def SymbolUri(self, symbol_name, file=""): # The URL should never contain the chars "<" or ">". symbol_name = lib_util.Base64Encode(symbol_name) # TODO: Alphabetical order !!!! return self.UriMakeFromDict("linker_symbol", { "Name": symbol_name, "File": lib_util.EncodeUri(file) })
def ClassUri(self, class_name, path=""): # The URL should never contain the chars "<" or ">". class_name = lib_util.Base64Encode(class_name) path = lib_util.standardized_file_path(path) return self.UriMakeFromDict("class", { "Name": class_name, "File": lib_util.EncodeUri(path) })
def MakeUri(strQuery, derivedEntity="sql/query", **kwargs): # sys.stderr.write("derivedEntity=%s strQuery=%s kwargs=%s\n"%(derivedEntity,strQuery,str(kwargs))) strQueryEncoded = lib_util.Base64Encode(strQuery) # The result might be: { "Query" : strQueryEncoded, "Pid" : thePid } # Rather CgiPropertyQuery() instead of "Query" allKeyedArgs = {"Query": strQueryEncoded} allKeyedArgs.update(kwargs) # Maybe we could take the calling module as derived entity ? return lib_common.gUriGen.UriMakeFromDict(derivedEntity, allKeyedArgs)
def MakeUri(strQuery, derivedEntity="sql/query", **kwargs): # TODO: This should rather rely on CgiPropertyB64, or have a fully generic solution for CGI-incompatible strings. strQueryEncoded = lib_util.Base64Encode(strQuery) # The result might be: { "Query" : strQueryEncoded, "Pid" : thePid } # Rather CgiPropertyQuery() instead of "Query" allKeyedArgs = {"Query": strQueryEncoded} allKeyedArgs.update(kwargs) # Maybe we could take the calling module as derived entity ? return lib_common.gUriGen.UriMakeFromDict(derivedEntity, allKeyedArgs)
def SymbolUri(self, symbol_name, path=""): # The URL should never contain the chars "<" or ">". symbol_name = lib_util.Base64Encode(symbol_name) # TODO: Move that to linker_symbol/__init__.py and see sources_types.sql.query.MakeUri # TODO: Alphabetical order !!!! path = lib_util.standardized_file_path(path) return self.UriMakeFromDict("linker_symbol", { "Name": symbol_name, "File": lib_util.EncodeUri(path) })
def UrlToMergeD3(): """This returns an URL to the Javascript D3 interface URL, which displays the current url in Javascript.""" calling_url = ModedUrl("") htbin_idx = calling_url.find(_htbin_prefix_script) url_without_host = calling_url[htbin_idx:] # Maybe this URL is already a merge of B64-encoded URLs: htbin_prefix_merge_script = "/survol/merge_scripts.py" if url_without_host.startswith(htbin_prefix_merge_script): # If so, no need to re-encode. url_without_host_b64 = url_without_host[len(htbin_prefix_merge_script ):] else: # This works on Windows with cgiserver.py just because the full script starts with "/survol" # url_without_host_b64 = "?url=" + lib_util.Base64Encode(url_without_host) # Complete URL with the host. This is necessary because index.htm has no idea # of where the useful part of the URL starts. # This works on Linux with Apache. url_without_host_b64 = "?url=" + lib_util.Base64Encode(calling_url) script_d3_url = UrlWWW("index.htm") + url_without_host_b64 return script_d3_url
def ValueEncode(self, valueClear): return lib_util.Base64Encode(valueClear)