def ajax_import(url, namespace=None, names=None): setCompilerOptions("noDebug") if __imported__.has_key(url): module = __imported__[url] else: req = load(url, None, None, False) module = None name_getter = [] if names is None: names = [] for name in names: name_getter.append("$pyjs$moduleObject['%s'] = %s;" % (name, name)) script = """(function ( ) { $pyjs$moduleObject={}; %s; %s return $pyjs$moduleObject; })();""" % (req.responseText, "\n".join(name_getter)) try: module = eval(script) except: e = sys.exc_info() raise AjaxError("Error in %s: %s" % (url, e.message)) __imported__[url] = module inject(module, namespace, names)
def callFlash(self, functionName, arguments=[]): """ @param functionName: Methodname of ExternalInterface @param arguments: List with arguments of ExternalInterfaces method @return: return value of ExternalInterfaces method """ movieElement = self.getMovieElement() if not movieElement: return None try: returnString = movieElement.CallFunction('<invoke name="%s" returntype="javascript">%s</invoke>' % (functionName, self.flashArgumentsToXML(arguments, 0))) returnValue = '' if returnString: if returnString != 'undefined': returnValue = eval(returnString) except: log.writebr('Call to '+functionName+' failed') return returnValue
def onload_fn(): wnd().status = ('Loaded ' + url) if not onload is None: eval(onload) return True
def eval(str): from __javascript__ import eval return eval(str)
def onload_fn(): wnd.status = ('Loaded ' + url) if not onload is None: eval(onload) return True