--- nfo/projects/netfraggle/bin/fraggleEngine.py 2004/08/30 13:03:13 1.5 +++ nfo/projects/netfraggle/bin/fraggleEngine.py 2004/08/31 02:23:07 1.6 @@ -5,13 +5,17 @@ # Author: joko # # Created: 2004/30/08 -# RCS-ID: $Id: fraggleEngine.py,v 1.5 2004/08/30 13:03:13 joko Exp $ +# RCS-ID: $Id: fraggleEngine.py,v 1.6 2004/08/31 02:23:07 joko Exp $ # Copyright: (c) 2004 netfrag.org # Licence: GPL #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # $Log: fraggleEngine.py,v $ +# Revision 1.6 2004/08/31 02:23:07 joko +# U changes to (dummy) topics metadata (FraggleXml) +# + def query_remote: wrapper for making remote xmlrpc call +# # Revision 1.5 2004/08/30 13:03:13 joko # - def getDefaultDir now in fraggleCtlPreferences # + def getTopicById @@ -58,22 +62,35 @@ # v1 - demo self.topics = [ { - 'name': 'iNFO-Test-ViaXMLRPC', + 'name': 'iNFO-Page:Test-ViaXMLRPC', 'mode': 'pull', + 'result': 'item', 'target': { 'url': 'http://netfrag.org/nfo/netfraggle.php', 'method': 'nfo.getContent', - 'arguments': ['Test'], + 'arguments': 'Test', 'type': 'XMLRPC', } }, { - 'name': 'iNFO-Home-ViaXMLRPC', + 'name': 'iNFO-Page:Home-ViaXMLRPC', 'mode': 'pull', + 'result': 'item', 'target': { 'url': 'http://netfrag.org/nfo/netfraggle.php', 'method': 'nfo.getContent', - 'arguments': ['Home'], + 'arguments': 'Home', + 'type': 'XMLRPC', + } + }, + { + 'name': 'iNFO-PageIndex', + 'mode': 'pull', + 'result': 'list', + 'target': { + 'url': 'http://netfrag.org/nfo/netfraggle.php', + 'method': 'nfo.listTopics', + 'arguments': ['xmlpage'], 'type': 'XMLRPC', } }, @@ -111,7 +128,35 @@ def getTopicById(self, id): return self.topics[id] + def query_remote(self, topicid): + topicmeta = self.getTopicById(topicid) + if topicmeta['target']['type'] == 'XMLRPC': + # TODO: make FraggleXMLRPC do all stuff + # (call methods dynamically) + from xmlrpclib import Server, Error + rpc = Server(topicmeta['target']['url']) + #try: + if topicmeta['result'] == 'item': + topicdata = {} + try: + #topicdata = rpc.getContent('Home') + #topicdata = rpc.getContent(tuple(topicmeta['target']['arguments'])) + topicdata = rpc.getContent(topicmeta['target']['arguments']) + #print topicdata + except Error, v: + print "ERROR", v + elif topicmeta['result'] == 'list': + topicdata = [] + try: + arg = {'type': 'xmlpage'} + topicdata = rpc.listTopics(arg) + #print topicdata + #self.styledTextContent.SetText(repr(topicdata)) + except Error, v: + print "ERROR", v + return topicdata + class urlOpener(object): """Opens urls.""" def __init__(self):