[Zope] ZCatalog and LoginManager - be aware.

Chris McDonough chrism@digicool.com
Tue, 28 Nov 2000 19:11:01 -0500


The problem is that one of your databases doesn't define the commit_sub()
and abort_sub() methods on the DB class it exposes.  You don't say which SQL
database you're using, but this happened to me on a consulting project with
ZOracleDA.  A solution is to add the following methods to the database
adapter's DB class inside DB.py:

def commit_sub(self, *arg, **kw):
   pass

def abort_sub(self, *arg, **kw):
   pass

This isn't optimal, because it sort of breaks transactional integrity, but
it does make it work.

----- Original Message -----
From: "Michel Pelletier" <michel@digicool.com>
To: "Oliver Bleutgen" <myzope@gmx.net>
Cc: <zope@zope.org>
Sent: Tuesday, November 28, 2000 6:12 PM
Subject: Re: [Zope] ZCatalog and LoginManager - be aware.


> Oliver Bleutgen wrote:
> >
> > Hi,
> >
> > I just wanted to mention a IMO bad pitfall when using ZCatalog, for
> > the sake of sparing others some time.
> >
> > I'm running Zope 2.2.2 with LoginManager with SQL in a subfolder and was
getting
> > the following error  when trying to find dtml-documents into ZCatalog:
> >
> > Error Type: AttributeError
> > Error Value: commit_sub
> >
> > Traceback (innermost last):
> >   File
/home/local-extranet/web/zope3/Zope-2.2.2-src/lib/python/ZPublisher/Publish.
py, line 222, in publish_module
> >   File
/home/local-extranet/web/zope3/Zope-2.2.2-src/lib/python/ZPublisher/Publish.
py, line 187, in publish
> >   File
/home/local-extranet/web/zope3/Zope-2.2.2-src/lib/python/Zope/__init__.py,
line 221, in zpublisher_exception_hook
> >     (Object: Traversable)
> >   File
/home/local-extranet/web/zope3/Zope-2.2.2-src/lib/python/ZPublisher/Publish.
py, line 175, in publish
> >   File
/home/local-extranet/web/zope3/Zope-2.2.2-src/lib/python/Zope/__init__.py,
line 235, in commit
> >   File
/home/local-extranet/web/zope3/Zope-2.2.2-src/lib/python/ZODB/Transaction.py
, line 261, in commit
> > AttributeError: (see above)
> >
> > All other object-types (incuding dtml-methods) seem to work. I have put
no
> > restrictions on which files I want found, but restricting something to
> > reduce the number of found objects helps.
> >
> > I fiddled around somewhat and discovered that disabling
> > subtransactions in ZCatalog does help (required for using
> > ZSQL Methods and ZCatalog in the same transaction).
>
> Yeah, that sux.  I think this is a known limitation.  I'm not sure.
>
> > Now I use SQL-based LoginManager, but why on earth did it only
> > fail on DTML-Documents? Is it because I have much more of them so
> > only then ZCatalog's subtransactions come into play?
>
> Probably because sub transactions are only commited after a certain
> number of words or values are indexed, and your DTML documents were the
> only things that held words.
>
> -Michel
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>
>