通过web表单修改python变量并返回outpu

2024-04-26 13:26:31 发布

您现在位置:Python中文网/ 问答频道 /正文

感谢您的回顾-我的目标是让web表单修改python变量并返回构建输出。python脚本在dict上迭代,只在“x”变量==1时返回输出。这个'x'变量是我需要修改的。下面,您将看到dict、变量和脚本,以及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键,并用jquery提交它。从那里我需要修改'x'变量,然后从python脚本返回输出。表格如下:

^{pr2}$

我已经通过cgi研究了原始输入,但对这个问题还不清楚。理想情况下,我希望使用jquery提交值,修改python变量,运行脚本并使用jquery返回输出。我知道Django的知识在这种情况下是非常有益的,但是我仍然是一个新手。在

非常感谢你的帮助。我很感激。在


Tags: ofsample脚本client表单dataloadspace
1条回答
网友
1楼 · 发布于 2024-04-26 13:26:31

为什么要为许多选项提交相同的值?如果不使用value-标记,脚本将在下拉列表中选择字符串。您只需要一个try-except-结构。在

相关问题 更多 >