[Zope] Re: zope.testbrowser, how to?

Andreas Jung lists at zopyx.com
Wed Feb 28 07:29:58 EST 2007


You might try the zope3-users mailing list.

-aj

--On 28. Februar 2007 18:17:23 +0600 Basil Shubin <basil.shubin at gmail.com> 
wrote:

> 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!
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )



-- 
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: info at zopyx.com - Phone +49 - 7071 - 793376
Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535
Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20070228/146bfd10/attachment.bin


More information about the Zope mailing list