我正在尝试在下面运行以下代码,但该代码始终失败,并显示标题中的错误:
追溯(最近一次通话最近):文件“ /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,在调用 self.body = self.oldhandler(* args,** kwargs)文件” / usr / local / lib /python2.7/dist-packages/cherrypy/_cpdispatch.py”,第61行,在调用中 返回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'对象没有属性'title'
似乎出错的代码块如下:
@cherrypy.expose
def 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>
一只名叫tom的猫
相关分类