我正在嘗試在下面運(yùn)行以下代碼,但該代碼始終失敗,并顯示標(biāo)題中的錯(cuò)誤:追溯(最近一次通話最近):文件“ /usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py”,行670,在response response.body = self.handler()文件“ / usr /local/lib/python2.7/dist-packages/cherrypy/lib/encoding.py“,行217,在調(diào)用 self.body = self.oldhandler(* args,** kwargs)文件” / usr / local / lib /python2.7/dist-packages/cherrypy/_cpdispatch.py”,第61行,在調(diào)用中 返回self.callable(* self.args,** self.kwargs)文件“ web / 800-53-server.py”,家庭control_list.append(' %s-%d-%s'%(id,control,id,control,sc.title.title)中的第79行)AttributeError:'NoneType'對(duì)象沒(méi)有屬性'title'似乎出錯(cuò)的代碼塊如下:@cherrypy.exposedef family(self, id="AC", format="html"): id = id.upper() family_control_count = {"AC": 25, "AU": 16, "AT": 5, "CM": 11, "CP": 13, "IA": 11, "IR": 10, "MA": 6, "MP": 8, "PS": 8, "PE": 20, "PL": 9, "PM": 16, "RA": 6, "CA": 9, "SC": 44, "SI": 17, "SA": 22} families = {"AC": "Access Control", "AU": "Audit and Accountability", "AT": "Awareness and Training", "CM": "Configuration Management", "CP": "Contingency Planning", "IA": "Identification and Authentication", "IR": "Incident Response", "MA": "Maintenance", "MP": "Media Protection", "PS": "Personnel Security", "PE": "Physical and Environmental Protection", "PL": "Planning", "PM": "Program Management", "RA": "Risk Assessment", "CA": "Security Assessment and Authorization", "SC": "System and Communications Protection", "SI": "System and Information Integrity", "SA": "System and Services Acquisition"} control_list = [] for control in range(1,family_control_count[id]+1): sc = SecControl("%s-%d" % (id, control)) control_list.append('<div><a href="/control?id=%s-%d">%s-%d</a> - %s</div>' % (id, control, id, control, sc.title.title)) return """<html>
1 回答

一只名叫tom的貓
TA貢獻(xiàn)1906條經(jīng)驗(yàn) 獲得超3個(gè)贊
包GovReady(我假設(shè)這是基于import語(yǔ)句使用的)依賴(lài)xsltproc。您可能已將其安裝在mac OS上,但未安裝在其他計(jì)算機(jī)上。sudo apt install xsltproc由于它不是pip軟件包,因此需要根據(jù)您的Linux風(fēng)格進(jìn)行安裝或與之等效。
嘗試xsltproc --stringparam controlnumber 'AC-1' control2json.xsl ../data/800-53-controls.xml從您的800-53-server/lib目錄運(yùn)行。您正在調(diào)用的函數(shù)是該命令的包裝器。
安裝該程序后,我得到
{ "id": "AC-1",
"title": "ACCESS CONTROL POLICY AND PROCEDURES",
...
}
添加回答
舉報(bào)
0/150
提交
取消