summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/edit/dashboard.py
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-05-02 05:58:59 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-05-02 05:58:59 +0000
commit5842f30c2abd2ca2b296257910b48c0c1b3567a8 (patch)
tree5475aae60227ae0b66fa9b88728b24134f7f8f84 /sca-cpp/trunk/modules/edit/dashboard.py
parent636e046fd1cdf7a6f1a365e4f02f5bbc2f593c70 (diff)
Change app data model a bit. Store app properties in separate files and support app cloning.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1098491 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/edit/dashboard.py')
-rw-r--r--sca-cpp/trunk/modules/edit/dashboard.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/sca-cpp/trunk/modules/edit/dashboard.py b/sca-cpp/trunk/modules/edit/dashboard.py
index 4dd48ccc17..81ec447d10 100644
--- a/sca-cpp/trunk/modules/edit/dashboard.py
+++ b/sca-cpp/trunk/modules/edit/dashboard.py
@@ -16,8 +16,6 @@
# under the License.
# Dashboards collection implementation
-import uuid
-import sys
from util import *
# Convert a particular user email to a dashboard id
@@ -31,16 +29,8 @@ def getdashboard(id, cache):
return ()
return dashboard
-# Post a new app to the user's dashboard
-def post(collection, app, user, cache):
- id = (str(uuid.uuid1()),)
- newapp = list("'entry", cadr(car(app)), list("'id", id), cadddr(car(app)))
- dashboard = cons(newapp, getdashboard(dashboardid(user), cache))
- cache.put(dashboardid(user), dashboard)
- return id
-
# Put an app into the user's dashboard
-def put(id, app, user, cache):
+def put(id, app, user, cache, apps):
def putapp(app, dashboard):
if isNil(dashboard):
return app
@@ -48,12 +38,16 @@ def put(id, app, user, cache):
return cons(car(app), cdr(dashboard))
return cons(car(dashboard), putapp(app, cdr(dashboard)))
- dashboard = putapp(app, getdashboard(dashboardid(user), cache))
+ appentry = (("'entry", cadr(car(app)), ("'id", car(id))),)
+ dashboard = putapp(appentry, getdashboard(dashboardid(user), cache))
cache.put(dashboardid(user), dashboard)
+
+ # Update app in app repository
+ apps.put(id, app);
return True
# Get apps from the user's dashboard
-def get(id, user, cache):
+def get(id, user, cache, apps):
def findapp(id, dashboard):
if isNil(dashboard):
return None
@@ -66,7 +60,7 @@ def get(id, user, cache):
return findapp(id, getdashboard(dashboardid(user), cache))
# Delete apps from the user's dashboard
-def delete(id, user, cache):
+def delete(id, user, cache, apps):
if isNil(id):
return cache.delete(dashboardid(user))
@@ -79,5 +73,8 @@ def delete(id, user, cache):
dashboard = deleteapp(id, getdashboard(dashboardid(user), cache))
cache.put(dashboardid(user), dashboard)
+
+ # Delete app from app repository
+ apps.delete(id);
return True