0

レビューしていただきありがとうございます - 私の目標は、Web フォームで Python 変数を変更し、ビルド出力を返すことです。Python スクリプトは dict を繰り返し処理し、'x' 変数 == 1 の場合にのみ出力を返します。この 'x' 変数は、変更する必要があるものです。以下に、辞書、変数、およびスクリプトが Web フォームに従って表示されます。

    SAMPLE_AUDIT_1 = {} 
    SAMPLE_AUDIT_1['VERSION'] = 'ORACLE 2012'
    SAMPLE_AUDIT_1['LINK'] = 'LINK TO THE AUDIT CONTENT'
    SAMPLE_AUDIT_1['Software Version'] = 0 
    SAMPLE_AUDIT_1['Server OS, Memory, CPU'] = 0 
    SAMPLE_AUDIT_1['DBMS Version'] = 0 
    SAMPLE_AUDIT_1['DBMS Statistics'] = 0
    SAMPLE_AUDIT_1['DBMS Parameters'] = 0
    SAMPLE_AUDIT_1['DBMS Data File Growth'] = 0
    SAMPLE_AUDIT_1['Database Disk Structure'] = 0
    SAMPLE_AUDIT_1['Long Running SQL'] = 0
    SAMPLE_AUDIT_1['Security Data Growth Range'] = 0
    SAMPLE_AUDIT_1['Extraneous entries in System Tables'] = 0
    SAMPLE_AUDIT_1['Feed Error Orphans'] = 1 
    SAMPLE_AUDIT_1['Position Detail Orphans'] = 1 
    SAMPLE_AUDIT_1['Data Retention Policy'] =  1
    SAMPLE_AUDIT_1['Securities Added Daily'] = 0
    SAMPLE_AUDIT_1['Security Master Load'] = 0
    SAMPLE_AUDIT_1['SRM Purge'] = 0
    SAMPLE_AUDIT_1['Best Pricing Purge'] = 0
    SAMPLE_AUDIT_1['Partitioning'] = 1 
    SAMPLE_AUDIT_1['DBMS Data/Log File Utilize Shared Disk'] = 0
    SAMPLE_AUDIT_1['DBMS Failover'] = 0
    SAMPLE_AUDIT_1['DBMS Client Version'] = 0
    SAMPLE_AUDIT_1['Star Engine IP Configuration'] = 0
    SAMPLE_AUDIT_1['Engine Count/Configuration'] = 1 
    SAMPLE_AUDIT_1['Engine Logging Interval'] = 1 
    SAMPLE_AUDIT_1['Engine Port Configuration'] = 0
    SAMPLE_AUDIT_1['Server Logging'] = 1 
    SAMPLE_AUDIT_1['Engine Log Configuration'] = 0
    SAMPLE_AUDIT_1['Engine Load Balancer Interval'] = 0
    SAMPLE_AUDIT_1['Engines Restarted Weekly'] = 0
    SAMPLE_AUDIT_1['Designated Master'] = 0
    SAMPLE_AUDIT_1['Cluster Managers Identical'] = 0
    SAMPLE_AUDIT_1['Uploader Shared Disk Space'] = 0
    SAMPLE_AUDIT_1['Custom Archive Rule Shared Disk Space'] = 0
    SAMPLE_AUDIT_1['Event Concurrency'] = 1 
    SAMPLE_AUDIT_1['Homogenous Engine Configuration'] = 0
    SAMPLE_AUDIT_1['Log Levels'] = 1 
    SAMPLE_AUDIT_1['Scheduler Purging'] = 0
    SAMPLE_AUDIT_1['Email Notification Basic Configuration'] = 0
    SAMPLE_AUDIT_1['Web Load Balancer Configuration'] = 0
    SAMPLE_AUDIT_1['Load Balancer Customizations'] = 0
    SAMPLE_AUDIT_1['Portal Shared Disk Space'] = 0
    SAMPLE_AUDIT_1['Message Center Shared Disk Space'] = 0
    SAMPLE_AUDIT_1['Message Center ID\'S'] = 0
    SAMPLE_AUDIT_1['Schedule Service Config'] = 1 
    SAMPLE_AUDIT_1['ePace is a client of Clustered App Servers'] = 1
    SAMPLE_AUDIT_1['Portal is a client of Clustered App Servers'] = 0
    SAMPLE_AUDIT_1['client of Clustered Engines'] = 1 
    SAMPLE_AUDIT_1['client of Clustered Report Export Services'] = 1 
    SAMPLE_AUDIT_1['WebSync Configured'] = 0
    SAMPLE_AUDIT_1['Web Server Load Balancing Configured'] = 0
    SAMPLE_AUDIT_1['Shared Disk Dynamic Folder'] = 0

    x = 'Feed Error Orphans'

    for k, v in SAMPLE_AUDIT_1.iteritems():
        if k == x and v == 1:
            print 'SAMPLE_AUDIT_1', SAMPLE_AUDIT_1['VERSION'], SAMPLE_AUDIT_1['LINK']

私の目標は、フォームのドロップダウンから dict キーの 1 つを選択し、jquery で送信することです。そこから、「x」変数を変更してから、Python スクリプトからの出力を返す必要があります。フォームは以下のとおりです。

<section id="forms">

  <div class="row">
    <div class="span10 offset1">
      <form class="form-horizontal well">
        <fieldset>
          <legend>Select Audit Point</legend>
              <div class="control-group">
                <label class="control-label" for="select01">Select Audit Point</label>
                <div class="controls">
                  <select id="select03">
                    <option value="all">Software Version</option>
                    <option value="all">Server OS, Memory, CPU</option>
                    <option value="all">High Availability</option>
                    <option value="db">DBMS Version</option>
                    <option value="db">DBMS Statistics</option>
                    <option value="db">DBMS Parameters</option>
                    <option value="db">DBMS Data File Growth</option>
                    <option value="db">Database Disk Structure</option>
                    <option value="db">Long Running SQL</option>
                    <option value="db">Security Data Growth Range</option>
                    <option value="db">Extraneous entries in System Tables</option>
                    <option value="db">Feed Error Orphans</option>
                    <option value="db">Position Detail Orphans</option>
                    <option value="db">Data Retention Policy</option>
                    <option value="db">Securities Added Daily</option>
                    <option value="db">Security Master Load</option>
                    <option value="db">SRM Purge</option>
                    <option value="db">Best Pricing Purge</option>
                    <option value="db">Partitioning</option>
                    <option value="db">DBMS Data/Log File Utilize Shared Disk</option>
                    <option value="db">DBMS Failover</option>
                    <option value="app">DBMS Client Version</option>
                    <option value="app">Star Engine IP Configuration</option>
                    <option value="app">Engine Count/Configuration</option>
                    <option value="app">Engine Logging Interval</option>
                    <option value="app">Engine Port Configuration</option>
                    <option value="app">Server Logging</option>
                    <option value="app">Engine Log Configuration</option>
                    <option value="app">Engine Load Balancer Interval</option>
                    <option value="app">Engines Restarted Weekly</option>
                    <option value="app">Designated Master</option>
                    <option value="app">Cluster Managers Identical</option>
                    <option value="app">Uploader Shared Disk Space</option>
                    <option value="app">Custom Archive Rule Shared Disk Space</option>
                    <option value="app">App Server Clustering</option>
                    <option value="app">Event Concurrency</option>
                    <option value="web">Homogenous Engine Configuration</option>
                    <option value="web">Log Levels</option>
                    <option value="web">Scheduler Purging</option>
                    <option value="web">Web Server Services Restarted Weekly</option>
                    <option value="web">Email Notification Basic Configuration</option>
                    <option value="web">Web Load Balancer Configuration</option>
                    <option value="web">Load Balancer Customizations</option>
                    <option value="web">Portal Shared Disk Space</option>
                    <option value="web">Message Center Shared Disk Space</option>
                    <option value="web">Message Center ID'S</option>
                    <option value="web">Schedule Service Config</option>
                    <option value="web">client of Clustered App Servers</option>
                    <option value="web">client of Clustered App Servers</option>
                    <option value="web">client of Clustered Load Balancers</option>
                    <option value="web">client of Clustered Engines</option>
                    <option value="web">client of Clustered Report Export Services</option>
                    <option value="web">WebSync Configured</option>
                    <option value="web">Web Server Load Balancing Configured</option>
                    <option value="web">Shared Disk Dynamic Folder</option>

                  </select>
                </div>
              </div>


              <div class="form-actions">
                <button type="submit" class="btn btn-primary">Submit</button>
                <button type="reset" class="btn">Cancel</button>
              </div>
            </fieldset>
          </form>
        </div>
      </div>

私は cgi を介して生の入力を調査しましたが、この件についてはまだ不明です。理想的には、jquery で値を送信し、python 変数を変更し、スクリプトを実行して、jquery で出力を返したいと考えています。この場合、Django の知識が非常に役立つことは理解していますが、私はまだ初心者です。

ご協力ありがとうございました。感謝しています。

4

1 に答える 1

0

多くのオプションに同じ値を送信するのはなぜですか? value-tag を省略した場合、スクリプトはドロップダウンで選択された文字列を取得します。必要なのはtry-except-construct だけです。

于 2013-06-26T19:54:29.493 に答える