12 |
|
|
13 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
14 |
# $Log$ |
# $Log$ |
15 |
|
# Revision 1.10 2004/09/13 21:07:38 xabbu |
16 |
|
# + function query added for testing of the nql / rpc interface |
17 |
|
# |
18 |
# Revision 1.9 2004/09/01 21:43:30 xabbu |
# Revision 1.9 2004/09/01 21:43:30 xabbu |
19 |
# +Moved funtion getDefaultDir from FraggleCtlPreferences to FraggleEngine for more convenience |
# +Moved funtion getDefaultDir from FraggleCtlPreferences to FraggleEngine for more convenience |
20 |
# +FraggleCtlModules class creation for handling content modules |
# +FraggleCtlModules class creation for handling content modules |
45 |
import FraggleXMLRPC |
import FraggleXMLRPC |
46 |
import fraggleCtlPreferences |
import fraggleCtlPreferences |
47 |
import FraggleCtlModules |
import FraggleCtlModules |
48 |
|
import fraggleParserXML |
49 |
|
|
50 |
class FraggleEngine: |
class FraggleEngine: |
51 |
"""Back-end doing the work.""" |
"""Back-end doing the work.""" |
74 |
return None |
return None |
75 |
|
|
76 |
def fraggleSync(self): |
def fraggleSync(self): |
77 |
|
#self.queryCms() |
78 |
|
fraggleParser = fraggleParserXML.create(self) |
79 |
# v1 - demo |
# v1 - demo |
80 |
self.topics = [ |
self.topics = [ |
81 |
{ |
{ |
129 |
} |
} |
130 |
}, |
}, |
131 |
] |
] |
132 |
|
topicfile = os.path.join(self.getDefaultDir(), 'topic.xml') |
133 |
|
fraggleParser.marshalXML(self.topics,topicfile) |
134 |
return |
return |
135 |
|
|
136 |
# v2 - live |
# v2 - live |
146 |
|
|
147 |
def getTopicById(self, id): |
def getTopicById(self, id): |
148 |
return self.topics[id] |
return self.topics[id] |
149 |
|
|
150 |
|
def listItems(self,topicId): |
151 |
|
result = self.queryCms("GET creator_id, language_id, description FROM contents") |
152 |
|
print result |
153 |
|
|
154 |
|
def queryCms(self,nqlquery): |
155 |
|
|
156 |
|
from xmlrpclib import Server,Error |
157 |
|
rpc = Server('http://netfrag.org/nfo/netfraggle.php') |
158 |
|
topicdata = rpc.query(nqlquery) |
159 |
|
print topicdata |
160 |
|
return topicdata |
161 |
|
|
162 |
def query_remote(self, topicmeta): |
def query_remote(self, topicmeta): |
163 |
|
|
164 |
if topicmeta['target']['type'] == 'XMLRPC': |
if topicmeta['target']['type'] == 'XMLRPC': |