ZODBBrowser can't handle some OrderedContainer subclasses

Bug #953484 reported by Marius Gedminas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ZODB Browser
Triaged
Low
Unassigned

Bug Description

From a mail by Thierry Florac:
> I've built a custom OrderedContainer subclass where _order is a
> PersistentList but where _data is an OOBTree.
>
> When trying to display such a class's instance in ZODBBrowser, I get a
> TypeError on "container._data.__setstate__(old_data_state)" (in
> state.py) with a bad arguments count ("TypeError: __setstate__() takes
> exactly 2 arguments (1 given)").

Revision history for this message
Marius Gedminas (mgedmin) wrote :

The time-limited-connection branch of ZODBBrowser ought to fix this.

Revision history for this message
Thierry Florac (tflorac) wrote :
Download full text (9.0 KiB)

Hi,
I made a new checkout of this branch and tried it (in a ZEO context, with ZODB-3.10.5).
I'm actually getting an IndexError on many (most !) pages...

Here is the traceback :

URL: /var/local/src/zodbbrowser-tlc/time-limited-connection/src/zodbbrowser/templates/zodbinfo.pt
File '/var/local/eggs/Paste-1.7.5.1-py2.6.egg/paste/evalexception/middleware.py', line 306 in respond
  app_iter = self.application(environ, detect_start_response)
File '/var/local/eggs/WebOb-1.2b2-py2.6.egg/webob/dec.py', line 132 in __call__
  resp = self.call_func(req, *args, **self.kwargs)
File '/var/local/eggs/WebOb-1.2b2-py2.6.egg/webob/dec.py', line 197 in call_func
  return self.func(req, *args, **kwargs)
File '/var/local/eggs/fanstatic-0.11.3-py2.6.egg/fanstatic/publisher.py', line 234 in __call__
  return request.get_response(self.app)
File '/var/local/eggs/WebOb-1.2b2-py2.6.egg/webob/request.py', line 1149 in get_response
  application, catch_exc_info=False)
File '/var/local/eggs/WebOb-1.2b2-py2.6.egg/webob/request.py', line 1118 in call_application
  app_iter = application(self.environ, start_response)
File '/var/local/eggs/WebOb-1.2b2-py2.6.egg/webob/dec.py', line 132 in __call__
  resp = self.call_func(req, *args, **self.kwargs)
File '/var/local/eggs/WebOb-1.2b2-py2.6.egg/webob/dec.py', line 197 in call_func
  return self.func(req, *args, **kwargs)
File '/var/local/eggs/fanstatic-0.11.3-py2.6.egg/fanstatic/injector.py', line 52 in __call__
  response = request.get_response(self.app)
File '/var/local/eggs/WebOb-1.2b2-py2.6.egg/webob/request.py', line 1149 in get_response
  application, catch_exc_info=False)
File '/var/local/eggs/WebOb-1.2b2-py2.6.egg/webob/request.py', line 1118 in call_application
  app_iter = application(self.environ, start_response)
File '/var/local/eggs/Paste-1.7.5.1-py2.6.egg/paste/translogger.py', line 68 in __call__
  return self.application(environ, replacement_start_response)
File '/var/local/env/ids/src/webapp/startup.py', line 32 in wrapper
  return app(environ, start_response)
File '/var/local/eggs/zope.app.wsgi-3.10.0-py2.6.egg/zope/app/wsgi/__init__.py', line 59 in __call__
  request = publish(request, handle_errors=handle_errors)
File '/var/local/eggs/zope.publisher-3.12.6-py2.6.egg/zope/publisher/publish.py', line 132 in publish
  result = publication.callObject(request, obj)
File '/var/local/eggs/zope.app.publication-3.12.0-py2.6.egg/zope/app/publication/zopepublication.py', line 207 in callObject
  return mapply(ob, request.getPositionalArguments(), request)
<bound method ZodbInfoView.__call__ of <zope.browserpage.metaconfigure.ZodbInfoView object at 0x6fe5c90>>
File '/var/local/eggs/zope.publisher-3.12.6-py2.6.egg/zope/publisher/publish.py', line 107 in mapply
  return debug_call(obj, args)
File '/var/local/eggs/zope.publisher-3.12.6-py2.6.egg/zope/publisher/publish.py', line 113 in debug_call
  return obj(*args)
File '/var/local/src/zodbbrowser-tlc/time-limited-connection/src/zodbbrowser/browser.py', line 91 in __call__
  return self.render()
File '/var/local/src/zodbbrowser-tlc/time-limited-connection/src/zodbbrowser/browser.py', line 149 in render
  return self.template()
File '/var/local/eggs/zope.browserpage-3.12.2-py...

Read more...

Revision history for this message
Marius Gedminas (mgedmin) wrote :

Hm, I've seen that IndexError while I was testing, but I was sure I'd fixed it a week ago... :(

Revision history for this message
Marius Gedminas (mgedmin) wrote :

I've doubts about the viability of the approach taken in the time-limited-connection branch.

I would appreciate suggestions of how to handle custom OrderedContainer subclasses reliably, because I'm out of ideas.

The pragmatic thing would be to register custom IObjectHistory/IStateInterpeter adapters based on the existing ones in btreesupport.py. If you use zodbbrowser as a plugin to your Zope-ish project, this will be simple. If you use a standalone zodbbrowser, it'll be trickier -- you might need to fork it.

Or you could contribute a BTree-based OrderedContainer back into zope.container, in which case I'll gladly add support for it in ZODBBrowser. ;-)

Changed in zodbbrowser:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Marius Gedminas (mgedmin) wrote :

This should be fixed in trunk, with a caveat: when _data is not a persistent object, you will not see accurate contents of historical versions. In fact you will probably get exceptions because _order and _data will be out of sync...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.