patch for issue related to zope.interface

Issue #1746 resolved
Former user created an issue

See http://comments.gmane.org/gmane.comp.python.zope.interface/241; SQLAlchemy gives this error:

File "/home/johnt/.buildout/eggs/SQLAlchemy-0.6beta2-py2.4.egg/sqlalchemy/ext/declarative.py", line 712, in init _as_declarative(cls, classname, cls.dict) File "/home/johnt/.buildout/eggs/SQLAlchemy-0.6beta2-py2.4.egg/sqlalchemy/ext/declarative.py", line 548, in _as_declarative obj = getattr(base,name) ConfigurationExecutionError: exceptions.AttributeError: provides in: File "/home/johnt/.buildout/eggs/hc.site.usersdb-1.0.2dev_r21543-py2.4.egg/hc/site/usersdb/configure.zcml", line 8.2-11.8 ...

So zope.interface is causing problems with getattr(); the attached patch makes it getattr(base,name,None). I have a patch that I will try to attach to this ticket (crosses fingers).

Comments (8)

  1. Mike Bayer repo owner
    • changed milestone to 0.6.0

    its fine but needs a test in test.ext.test_declarative on a class that overrides __getattribute__, probably raises an error on a certain attribute name.

  2. Former user Account Deleted

    Replying to zzzeek:

    its fine but needs a test in test.ext.test_declarative on a class that overrides __getattribute__, probably raises an error on a certain attribute name.

    I'll give it a shot.

  3. Former user Account Deleted

    Replying to guest:

    Replying to zzzeek:

    its fine but needs a test in test.ext.test_declarative on a class that overrides __getattribute__, probably raises an error on a certain attribute name.

    I'll give it a shot.

    The getattr() in _as_declarative is looking at class attributes, not instance attributes. It's not immediately obvious to me how to create on that shows up in dir(), but throws an error in getattr(). Ideas?

  4. Former user Account Deleted

    Replying to zzzeek:

    well this is the thing. What's Zope doing that requires this change ?

    zope.interface is adding this crazy {{{provides}}} class attribute that shows up in dir(), but {{{getattr(cls,"provides")}}} throws {{{AttributeError}}}.

  5. Log in to comment