[Zope3-Users] zope.testbrowser and ZMI?

Basil Shubin basil.shubin at gmail.com
Wed Feb 28 08:14:31 EST 2007


Hi friends!

Hmm... strange thing...

With this code I got:

 >>> browser = Browser('http://localhost:8080/')
 >>> browser.addHeader('Authorization', 'Basic admin:admin')
 >>> browser.open('http://localhost:8080/manage')
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/usr/lib/python2.4/site-packages/zope/testbrowser/browser.py", 
line 220, in open
     self.mech_browser.open(url, data)
   File "/usr/lib/python2.4/site-packages/mechanize/_mechanize.py", line 
254, in open
     return self._mech_open(url, data)
   File "/usr/lib/python2.4/site-packages/mechanize/_mechanize.py", line 
277, in _mech_open
     self._response = UserAgent.open(self, self.request, data)
   File "/usr/lib/python2.4/urllib2.py", line 364, in open
     response = meth(req, response)
   File "/usr/lib/python2.4/urllib2.py", line 471, in http_response
     response = self.parent.error(
   File "/usr/lib/python2.4/urllib2.py", line 402, in error
     return self._call_chain(*args)
   File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
     result = func(*args)
   File "/usr/lib/python2.4/urllib2.py", line 480, in http_error_default
     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error

than with this:

 >>> browser = Browser('http://localhost:8080/manage')
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/usr/lib/python2.4/site-packages/zope/testbrowser/browser.py", 
line 162, in __init__
     self.open(url)
   File "/usr/lib/python2.4/site-packages/zope/testbrowser/browser.py", 
line 220, in open
     self.mech_browser.open(url, data)
   File "/usr/lib/python2.4/site-packages/mechanize/_mechanize.py", line 
254, in open
     return self._mech_open(url, data)
   File "/usr/lib/python2.4/site-packages/mechanize/_mechanize.py", line 
277, in _mech_open
     self._response = UserAgent.open(self, self.request, data)
   File "/usr/lib/python2.4/urllib2.py", line 364, in open
     response = meth(req, response)
   File "/usr/lib/python2.4/urllib2.py", line 471, in http_response
     response = self.parent.error(
   File "/usr/lib/python2.4/urllib2.py", line 402, in error
     return self._call_chain(*args)
   File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
     result = func(*args)
   File "/usr/lib/python2.4/urllib2.py", line 480, in http_error_default
     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 401: Unauthorized

and after all:

 >>> browser = Browser()
 >>> browser.addHeader('Authorization', 'Basic admin:admin')
 >>> browser.open('http://localhost:8080/manage')
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/usr/lib/python2.4/site-packages/zope/testbrowser/browser.py", 
line 220, in open
     self.mech_browser.open(url, data)
   File "/usr/lib/python2.4/site-packages/mechanize/_mechanize.py", line 
254, in open
     return self._mech_open(url, data)
   File "/usr/lib/python2.4/site-packages/mechanize/_mechanize.py", line 
277, in _mech_open
     self._response = UserAgent.open(self, self.request, data)
   File "/usr/lib/python2.4/urllib2.py", line 364, in open
     response = meth(req, response)
   File "/usr/lib/python2.4/urllib2.py", line 471, in http_response
     response = self.parent.error(
   File "/usr/lib/python2.4/urllib2.py", line 402, in error
     return self._call_chain(*args)
   File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
     result = func(*args)
   File "/usr/lib/python2.4/urllib2.py", line 480, in http_error_default
     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error

Is there any way to get access to http://<site>/manage page with 
zope.testbrowser?

Thanks!



More information about the Zope3-users mailing list