コード例 #1
0
ファイル: views.py プロジェクト: Doula/DoulaOpen
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) }
コード例 #2
0
ファイル: views.py プロジェクト: Doula/DoulaOpen
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 })
コード例 #3
0
ファイル: views.py プロジェクト: Doula/DoulaOpen
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 })
コード例 #4
0
ファイル: views.py プロジェクト: Doula/DoulaOpen
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 }