dabo Commit
Revision 4925
Date: 2009-01-11 20:22:44 -0800 (Sun, 11 Jan 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/4925
Changed:
U trunk/dabo/lib/RemoteConnector.py
Log:
Implemented the getFieldNames() method to support remote discovery of table
structures.
Improved the code for determining the remote URL.
Diff:
Modified: trunk/dabo/lib/RemoteConnector.py
===================================================================
--- trunk/dabo/lib/RemoteConnector.py 2009-01-12 04:20:03 UTC (rev 4924)
+++ trunk/dabo/lib/RemoteConnector.py 2009-01-12 04:22:44 UTC (rev 4925)
@@ -168,10 +168,12 @@
path = path.lstrip("/")
self._baseURL = "%s://%s" % (scheme, host)
listURL = "%s://%s/manifest" % (scheme, host)
+ res = None
try:
res = jsonDecode(self._read(listURL))
except urllib2.URLError, e:
code, msg = e.reason
+# print "CODE<MSG", code, msg
if code == 61:
# Connection refused; server's down
return "Error: The server is not responding.
Please try later"
@@ -183,6 +185,8 @@
# If they passed an app name, and it's in the returned app
list, run it
if path and (path in res):
return path
+ else:
+ return res
# We have a list of available apps. Let the user select one
class AppPicker(dabo.ui.dOkCancelDialog):
def addControls(self):
@@ -310,17 +314,20 @@
def rollbackTransaction(self): return False
- def getFields(self, tableName):
- saveObj = self.obj
- class Dummy(object):
- DataSource = tableName
- self.obj = Dummy()
+ def getFieldNames(self):
url = self._getFullUrl("fields")
enc = self._read(url)
flds = jsonDecode(enc)
return flds
+ def getFieldNames(self):
+ url = self._getFullUrl("fields")
+ enc = self._read(url)
+ flds = jsonDecode(enc)
+ return flds
+
+
def _getConnection(self):
return self.obj._getConnection()
@@ -344,6 +351,8 @@
if self._baseURL:
# Set explicitly by the launch() method
return self._baseURL
+ app = dabo.dAppRef
+ ret = ""
try:
ret = self.Connection.ConnectInfo.RemoteHost
except AttributeError:
@@ -351,9 +360,10 @@
try:
ret = self.obj.SourceURL
except AttributeError:
- ret = ""
+ # Use the app object
+ if app:
+ ret = app.SourceURL
else:
- app = dabo.dAppRef
if app and not app.SourceURL:
app.SourceURL = ret
return ret
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]