擅长:python、mysql、java
<p>在对框架代码进行了一些研究之后,我发现了下一个:</p>
<p>包中的HTTPServer是一个自定义的HTTPServer,它有一个<code>__getattr__</code>内置集,当访问一个不“is_secure”的属性时,它会出现异常。在</p>
<pre><code># Code from HTTPServer.py
def __getattr__(self, attr):
if attr == "is_secure":
return getattr(self.servertype.create_socket, "is_secure", False)
raise AttributeError(attr) # This is the buggy statement
</code></pre>
<p>因此,在普通情况下,任何被访问的HTTPServer属性(除了“is_secure”)都将不可避免地引发异常。在</p>
<p>我想你有三个选择:</p>
<ol>
<li>固定测试功能,使其正常工作</li>
<li>在不使用测试函数的情况下继续工作,并尝试使框架正常工作</li>
<li>遵循Tiger-222解决方案并坚持使用<em>SimpleHTTPServer</em></li>
</ol>