diff options
Diffstat (limited to 'sca-cpp/trunk/modules/edit/apps.py')
-rw-r--r-- | sca-cpp/trunk/modules/edit/apps.py | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/sca-cpp/trunk/modules/edit/apps.py b/sca-cpp/trunk/modules/edit/apps.py index 4add10a239..a820f969cb 100644 --- a/sca-cpp/trunk/modules/edit/apps.py +++ b/sca-cpp/trunk/modules/edit/apps.py @@ -15,15 +15,13 @@ # specific language governing permissions and limitations # under the License. -# Apps collection implementation -import uuid -import sys +# App collection implementation import os from util import * # Convert an id to an app id def appid(id): - return ("'" + car(id), "'app.composite") + return ("'" + car(id), "'app.stats") # Link implementation resources into an app def mkapplink(id): @@ -31,45 +29,41 @@ def mkapplink(id): os.symlink('../../../../../nuvem/nuvem-parallel/nuvem', 'apps/' + car(id) + '/nuvem') os.symlink('../../../../components', 'apps/' + car(id) + '/lib') os.mkdir('apps/' + car(id) + '/htdocs') - os.symlink('../../../htdocs/cache-manifest.cmf', 'apps/' + car(id) + '/htdocs/cache-manifest.cmf'); - os.symlink('../../../htdocs/login', 'apps/' + car(id) + '/htdocs/login'); - os.symlink('../../../htdocs/logout', 'apps/' + car(id) + '/htdocs/logout'); - os.symlink('../../../htdocs/public', 'apps/' + car(id) + '/htdocs/public'); - os.symlink('../../../htdocs/data', 'apps/' + car(id) + '/htdocs/data'); - os.symlink('../../../htdocs/app/index.html', 'apps/' + car(id) + '/htdocs/index.html'); - os.symlink('../../../htdocs/robots.txt', 'apps/' + car(id) + '/htdocs/robots.txt'); - os.symlink('../../../htdocs/favicon.ico', 'apps/' + car(id) + '/htdocs/favicon.ico'); - os.symlink('../app.html', 'apps/' + car(id) + '/htdocs/app.html'); except: pass return True -# Post a new app to the apps db -def post(collection, app, cache): - id = appid((str(uuid.uuid1()),)) - comp = cdr(cadddr(car(app))) - cache.put((id,), comp) - mkapplink((id,)) - return id - # Put an app into the apps db -def put(id, app, cache): - comp = cdr(cadddr(car(app))) - cache.put(appid(id), comp) +def put(id, app, cache, store, composites, pages): + eid = cadr(caddr(car(app))) + appentry = (("'entry", cadr(car(app)), ("'id", car(id))),) + + # Update app in apps db + if car(id) == eid: + cache.put(appid(id), appentry) + mkapplink(id) + return True + + # Clone an app's composite and page + cache.put(appid(id), appentry) mkapplink(id) + composites.put(id, composites.get((eid,))) + pages.put(id, pages.get((eid,))) return True # Get an app from the apps db -def get(id, cache): +def get(id, cache, store, composites, pages): if isNil(id): return (("'feed", ("'title", "Apps"), ("'id", "apps")),) app = cache.get(appid(id)); if (isNil(app) or app is None): return (("'entry", ("'title", car(id)), ("'id", car(id))),) - return (("'entry", ("'title", car(id)), ("'id", car(id)), ("'content", car(app))),) + return app # Delete an app from the apps db -def delete(id, cache): +def delete(id, cache, store, composites, pages): cache.delete(appid(id)) + composites.delete(id) + pages.delete(id) return True |