dabo Commit
Revision 4813
Date: 2008-12-10 08:29:39 -0800 (Wed, 10 Dec 2008)
Author: Ed
Trac: http://trac.dabodev.com/dabo/changeset/4813
Changed:
U trunk/INSTALL
U trunk/dabo/__version__.py
A trunk/daboserver/README
U trunk/daboserver/config/routing.py
U trunk/daboserver/controllers/bizservers.py
Log:
Final changes before creating the 0.9.0 release
Diff:
Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL 2008-12-10 14:48:02 UTC (rev 4812)
+++ trunk/INSTALL 2008-12-10 16:29:39 UTC (rev 4813)
@@ -31,19 +31,28 @@
The 'ide' folder contains our visual tools, such as the Class Designer, which
you can use to visually design your UI; the connection editor ('CxnEditor'),
which is used to create connections to database servers, as well as several
-other useful visual tools.
+other useful visual tools.
+There's also the new 'daboserver' directory. This is the 'guts' of a
+Pylons server that will work with the web app features of Dabo. The only
+modified files are the 'bizservers.py' controller, the routing.py file
+in config, the OrdersBizobj.py sample for a remote bizobj, and the
+'appSource' directory, which contains the source of the remote app. I
+plan on documenting how all this stuff works over the next few months,
+so keep an eye out for that!
+
HAVING PROBLEMS?
But... if you have trouble installing, and for whatever reason the setup.py
doesn't work, just add a file named 'dabo.pth' to your site-packages directory,
with the path to dabo e.g. '/home/pmcnett/projects/dabo'.
If you are on Linux and got the following error:
-error: invalid Python installation: unable to open
/usr/lib/python2.4/config/Makefile (No such file or directory)
+error: invalid Python installation: unable to open
/usr/lib/python2.6/config/Makefile (No such file or directory)
and you really want to get setup.py to install dabo for you, you need to
install the python-dev package. For instance (on Debian):
-apt-get install python2.4-dev
+apt-get install python2.6-dev
+(assuming you are running python2.6; change the version number as appropriate).
Modified: trunk/dabo/__version__.py
===================================================================
--- trunk/dabo/__version__.py 2008-12-10 14:48:02 UTC (rev 4812)
+++ trunk/dabo/__version__.py 2008-12-10 16:29:39 UTC (rev 4813)
@@ -2,7 +2,7 @@
# The following 3 lines are the only thing you should change in this file.
# Everything else is boilerplate copied also to other dabo repositories.
package_name = "dabo"
-_version = "0.8.4"
+_version = "0.9.0"
_approximateRevision = "~4812"
import os
Added: trunk/daboserver/README
===================================================================
--- trunk/daboserver/README (rev 0)
+++ trunk/daboserver/README 2008-12-10 16:29:39 UTC (rev 4813)
@@ -0,0 +1,18 @@
+This is the main server portion of a Pylons installation that will serve
+Dabo applications, making them true web apps.
+
+The primary files of interest are:
+
+controllers/bizservers.py: the main controller that handles web requests
+ and works with the Dabo bizobjs as needed.
+
+config/routing.py: routes the URLs of the requests to the appropriate
+ controller methods.
+
+controllers/OrdersBizobj.py: sample remote bizobj for the demo app.
+
+appSource: the directory containing the source files for your
+ application.
+
+
+To use this, you will need Pylons installed. You would then create a new app
using paste named 'daboserver'. This will create a directory named
'daboserver', which will contain a subdirectory also named 'daboserver'.
Replace that subdirectory with the one included here, and start the webserver.
Modified: trunk/daboserver/config/routing.py
===================================================================
--- trunk/daboserver/config/routing.py 2008-12-10 14:48:02 UTC (rev 4812)
+++ trunk/daboserver/config/routing.py 2008-12-10 16:29:39 UTC (rev 4813)
@@ -22,6 +22,7 @@
map.connect("man1", "/manifest/:app/:fnc/:id", controller="bizservers",
action="manifest")
map.connect("man2", "/manifest/:app/:fnc", controller="bizservers",
action="manifest")
map.connect("man3", "/manifest/:app", controller="bizservers",
action="manifest")
+ map.connect("man3", "/manifest", controller="bizservers",
action="manifest")
map.connect("biz1", "/:controller/:action/:hashval/:ds/:method")
return map
Modified: trunk/daboserver/controllers/bizservers.py
===================================================================
--- trunk/daboserver/controllers/bizservers.py 2008-12-10 14:48:02 UTC (rev
4812)
+++ trunk/daboserver/controllers/bizservers.py 2008-12-10 16:29:39 UTC (rev
4813)
@@ -23,6 +23,8 @@
from daboserver.lib.base import BaseController, render
from dabo.dException import WebServerException
from dabo.lib.manifest import Manifest
+jsonEncode = dabo.lib.jsonEncode
+jsonDecode = dabo.lib.jsonDecode
#-------------------------------------------------------
#-------------------------------------------------------
@@ -77,20 +79,24 @@
params = request.params
sql = params.get("SQL")
kf = params.get("KeyField")
+ sqlparams = params.get("SQLParams")
+ evParams = eval(sqlparams)
biz.KeyField = kf
+ biz.setParams(evParams)
biz.storeRemoteSQL(sql)
biz.requery()
data = biz.getDataSet(returnInternals=True)
dumped = pickle.dumps(data)
typs = pickle.dumps(biz.getDataTypes())
- ret = dabo.lib.jsonEncode((dumped, typs))
+ stru = pickle.dumps(biz.getDataStructure())
+ ret = jsonEncode((dumped, typs, stru))
return ret
def save(self, biz, hashval, ds, *args, **kwargs):
params = request.params
encdiff = params.get("DataDiff")
- diff = dabo.lib.jsonDecode(encdiff)
+ diff = jsonDecode(encdiff)
try:
err = biz.applyDiffAndSave(diff, primary=True)
except WebServerException, e:
@@ -101,7 +107,7 @@
abort(err[0], err[1])
data = biz.getDataSet(returnInternals=True)
typs = pickle.dumps(biz.getDataTypes())
- ret = dabo.lib.jsonEncode((data, typs))
+ ret = jsonEncode((data, typs))
return ret
@@ -115,7 +121,7 @@
abort(500, e)
data = biz.getDataSet(returnInternals=True)
typs = pickle.dumps(biz.getDataTypes())
- ret = dabo.lib.jsonEncode((data, typs))
+ ret = jsonEncode((data, typs))
return ret
@@ -127,20 +133,30 @@
return cursor
- def manifest(self, app, fnc=None, id=None, *args, **kwargs):
+ def manifest(self, app=None, fnc=None, id=None, *args, **kwargs):
+ if app is None:
+ # Return list of available apps.
+ dirnames = [d for d in os.listdir(sourcePath)
+ if not d.startswith(".")]
+ return jsonEncode(dirnames)
+
crs = self.getFileRequestDB()
+ enclocal = request.params.get("current", "")
+ try:
+ local = jsonDecode(enclocal)
+ except ValueError:
+ # No local manifest passed
+ local = None
appPath = os.path.join(sourcePath, app)
mf = Manifest.getManifest(appPath)
# Handle the various functions
if fnc is None or fnc == "full":
# Send the full manifest
pmf = pickle.dumps(mf)
- ret = dabo.lib.jsonEncode(pmf)
+ ret = jsonEncode(pmf)
return ret
elif fnc == "diff":
- enclocal = request.params.get("current")
- local = dabo.lib.jsonDecode(enclocal)
chgs = Manifest.diff(mf, local)
if not chgs:
abort(304, _("No changes"))
@@ -161,13 +177,14 @@
updated = int(time.time())
sql = """insert into filecache (hashval,
updated, pickledata)
values (?, ?, ?)"""
- crs.execute(sql, (hashval, updated,
pickle.dumps(chgs)))
+ pkData = str(chgs)
+ crs.execute(sql, (hashval, updated, pkData))
else:
# No added/updated files. Return a zero
filecode to signify nothing to download
hashval = 0
# Return the hashval and manifest so that the user can
request the files
retPickle = pickle.dumps((hashval, chgs, mf))
- return dabo.lib.jsonEncode(retPickle)
+ return jsonEncode(retPickle)
elif fnc == "files":
# The client is requesting the changed files. The
hashval will
@@ -175,7 +192,7 @@
sql = """select pickledata from filecache
where hashval = ?"""
crs.execute(sql, (id, ))
- chgs = pickle.loads(crs.Record.pickledata)
+ chgs = eval(crs.Record.pickledata)
# Need to cd to the source directory
currdir = os.getcwd()
os.chdir(appPath)
@@ -194,3 +211,8 @@
os.remove(tmpname)
return ret
+
+ def fields(self, biz, hashval, ds, *args, **kwargs):
+ ret = (biz.DataSource, hashval, ds, args, kwargs)
+ return jsonEncode(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]