collective / pas.plugins.sqlalchemy

SQLAlchemy PAS plugin (Authentication) for Zope2/ Plone
http://plone.org/products/pas.plugins.sqlalchemy/
7 stars 7 forks source link

cyclic dependency using collective.saconnect #7

Closed auspex closed 13 years ago

auspex commented 13 years ago

While using collective.saconnect to configure pas.plugins.sqlalchemy is admirable, it doesn't actually seem workable.

collective.saconnect needs to be correctly configured before almost anything can be done on the site.

I got this from trying to install pps, z3c.saconfig and collective.saconnect at the same time:

Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.BaseRequest, line 596, in traverse
  Module Products.PluggableAuthService.PluggableAuthService, line 226, in validate
  Module Products.PluggableAuthService.PluggableAuthService, line 599, in _extractUserIds
  Module pas.plugins.sqlalchemy.plugin, line 92, in wrapper
  Module pas.plugins.sqlalchemy.plugin, line 247, in authenticateCredentials
  Module sqlalchemy.orm.scoping, line 53, in __call__
  Module sqlalchemy.util._collections, line 840, in __call__
  Module z3c.saconfig.scopedsession, line 34, in <lambda>
  Module z3c.saconfig.scopedsession, line 19, in scopefunc
  Module zope.component._api, line 169, in getUtility
ComponentLookupError: (<InterfaceClass z3c.saconfig.interfaces.IScopedSession>, 'pas.plugins.sqlalchemy')

And any attempt to look at a Plone page, or even the ZMI, fails with a We’re sorry, but there seems to be an error…

At first glance, it seems that the problem is that the @graceful_recovery decorator ... doesn't.

I'm going to take a look to see if catching ComponentLookupError as well as SQLAlchemyError would be helpful.

malthe commented 13 years ago

Probably needs to catch a few other exception classes.

Definitely not a very graceful recovery :-)

auspex commented 13 years ago

Yes, I figured there were probably others.

I should find out what happens with a misconfigured connection, too, but for this particular situation, catching the ComponentLookupError seems to do the job. I'll submit a pull request just as soon as I remember how :-)

auspex commented 13 years ago

https://github.com/collective/pas.plugins.sqlalchemy/pull/8 will fix the immediate problem