dabo Commit
Revision 5684
Date: 2010-02-15 08:58:05 -0800 (Mon, 15 Feb 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5684
Changed:
U trunk/daboserver/controllers/bizservers.py
U trunk/daboserver/controllers/webupdate.py
Log:
Updated the bizservers code to eliminate unnecessary pickling. Also changed the
pathing for the source files so that they are not frozen in the egg.
Updated the webupdate script to use the Pylons jsonify decorator.
Diff:
Modified: trunk/daboserver/controllers/bizservers.py
===================================================================
--- trunk/daboserver/controllers/bizservers.py 2010-02-15 16:52:11 UTC (rev
5683)
+++ trunk/daboserver/controllers/bizservers.py 2010-02-15 16:58:05 UTC (rev
5684)
@@ -29,7 +29,7 @@
#-------------------------------------------------------
#-------------------------------------------------------
-# START OF CUSTOMIZIATION
+# START OF CUSTOMIZATION
#-------------------------------------------------------
# The next two sections are the only parts you have to edit
# for your application. Be sure to specify the bizobj classes
@@ -50,20 +50,14 @@
dabo._bizDict = {
"people": PeopleBizobj,
"activities": ActivitiesBizobj}
-#-------------------------------------------------------
-# END OF CUSTOMIZIATION
-#-------------------------------------------------------
# The path to the server copy of the web application source files *MUST* be
# defined here. It is used to compare local app manifests in order to
# determine what changes, if any, have been made to the app.
-cd = os.getcwd()
-if cd == "/":
- # Running as an egg through WSGI
- cd = [p for p in sys.path
- if "daboserver" in p][0]
-home_dir = os.path.join(cd, "daboserver")
-sourcePath = os.path.join(home_dir, "appSource")
+sourcePath = "/home/dabo/appSource"
+#-------------------------------------------------------
+# END OF CUSTOMIZIATION
+#-------------------------------------------------------
@@ -144,18 +138,20 @@
def getFileRequestDB(self):
- db = os.path.join(home_dir, "DaboFileCache.db")
+ db = "/tmp/DaboFileCache.db"
cxn = dabo.db.dConnection(connectInfo={"DbType": "SQLite",
"Database": db},
- forceCreate=True)
+ forceCreate=True)
cursor = cxn.getDaboCursor()
return cursor
def manifest(self, app=None, fnc=None, id=None, *args, **kwargs):
+ file("/tmp/manifest", "a").write("MANIFEST: app=%s\n" % app)
if app is None:
# Return list of available apps.
dirnames = [d for d in os.listdir(sourcePath)
if not d.startswith(".")]
+ file("/tmp/manifest", "a").write("%s\n" % str(dirnames))
return jsonEncode(dirnames)
crs = self.getFileRequestDB()
@@ -167,6 +163,8 @@
local = None
appPath = os.path.join(sourcePath, app)
mf = Manifest.getManifest(appPath)
+ file("/tmp/manifest", "a").write("appPath: %s\n" % appPath)
+ file("/tmp/manifest", "a").write("mf: %s\n" % str(mf))
# Handle the various functions
if fnc is None or fnc == "full":
# Send the full manifest
@@ -201,8 +199,7 @@
# 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 jsonEncode(retPickle)
+ return jsonEncode((hashval, chgs, mf))
elif fnc == "files":
# The client is requesting the changed files. The
hashval will
@@ -225,7 +222,7 @@
z.close()
response.headers['content-type'] =
"application/x-zip-compressed"
os.chdir(currdir)
- ret = file(tmpname).read()
+ ret = file(tmpname, "rb").read()
os.remove(tmpname)
return ret
Modified: trunk/daboserver/controllers/webupdate.py
===================================================================
--- trunk/daboserver/controllers/webupdate.py 2010-02-15 16:52:11 UTC (rev
5683)
+++ trunk/daboserver/controllers/webupdate.py 2010-02-15 16:58:05 UTC (rev
5684)
@@ -3,7 +3,9 @@
import os
import tempfile
from zipfile import ZipFile
+from dabo.lib.xmltodict import xmltodict, dicttoxml
+from pylons.decorators import jsonify
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to
@@ -20,10 +22,31 @@
_deletedFilesName = "DELETEDFILES"
+ @jsonify
+ def xxx(self, val):
+ return "You typed: %s" % val
+
+
+ @jsonify
def check(self, val):
- return simplejson.dumps(Versions.changes(val))
+ return Versions.changes(val)
+ @jsonify
+ def latest(self):
+ return Versions.latest()
+
+
+ def checkNoJson(self, val):
+ chgs = Versions.changes(val)
+ return str(chgs)
+
+
+ @jsonify
+ def changelog(self):
+ return Versions.getLog()
+
+
def files(self, val):
currdir = os.getcwd()
chgs = Versions.changes(val)["files"]
@@ -67,4 +90,4 @@
os.remove(tmpname)
os.chdir(currdir)
return ret
-
\ No newline at end of file
+
_______________________________________________
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]