def show_site(request): dao = SiteDAO() site = dao.get_site(request.matchdict['site']) if not site: msg = 'Unable to find site "{0}"'.format(request.matchdict['site']) raise HTTPNotFound(msg) return { 'site': site, 'site_json': dumps(site) }
def deploy_application(request): try: dao = SiteDAO() site = dao.get_site(request.POST['site']) app = site.applications[request.POST['application']] app.deploy_application(site) return dumps({ 'success': True, 'app': app }) except KeyError as e: msg = 'Unable to deploy application under "{0}"' msg = msg.format(request.POST['site'], request.POST['application']) return dumps({ 'success': False, 'msg': msg })
def tag_application(request): try: dao = SiteDAO() site = dao.get_site(request.POST['site']) app = site.applications[request.POST['application']] app.tag(request.POST['tag'], request.POST['msg']) return dumps({ 'success': True, 'app': app }) except KeyError as e: msg = 'Unable to tag site and application under "{0}" and "{1}"' msg = msg.format(request.POST['site'], request.POST['application']) return dumps({ 'success': False, 'msg': msg })
def show_application(request): try: dao = SiteDAO() site = dao.get_site(request.matchdict['site']) app = site.applications[request.matchdict['application']] if take_note(request, app): app.add_note(request.POST['note']) except: if 'note' in request.POST: msg = 'Unable to add note to "{0}"' msg = msg.format(request.matchdict['application']) else: msg = 'Unable to find site and application under "{0}" and "{1}"' msg = msg.format(request.matchdict['site'], request.matchdict['application']) raise HTTPNotFound(msg) return { 'site': site, 'app': app }