Opened 10 years ago

Closed 9 years ago

#2199 defect closed fixed (fixed)

Adaption of web2.iweb interfaces is broken

Reported by: wsanchez Owned by:
Priority: highest Milestone: Web2-Gold-Master
Component: web2 Keywords:
Cc: wsanchez Branch:
Author: Launchpad Bug:


As of r18455, adaption of web2.iweb interfactes is broken in that it no longer raises TypeError when adaptions fails and instead returns None.

A change to SpecialAdaptInterfaceClass.__call__() appears to be the cause.

Change History (5)

comment:1 Changed 10 years ago by wsanchez

  • Summary changed from Adaption of web2.iweb interfactes is broken to Adaption of web2.iweb interfaces is broken

Perhaps something more like:

# Is there a better way to do this than this funky extra class?
NotSpecified = object()
class SpecialAdaptInterfaceClass(interface.InterfaceClass):
    # A special adapter for IResource to handle the extra step of adapting
    # from IOldNevowResource-providing resources.
    def __call__(self, other, alternate=NotSpecified):
        if alternate == NotSpecified:
                return super(SpecialAdaptInterfaceClass, self).__call__(other)
            except TypeError:
            result = super(SpecialAdaptInterfaceClass, self).__call__(other, alternate)
            if result is not alternate:
                return result
        if alternate == NotSpecified:
            return IOldNevowResource(other)
        result = IOldNevowResource(other, alternate)
        if result is not alternate:
            return IResource(result)
        return alternate
IResource.__class__ = SpecialAdaptInterfaceClass

comment:2 Changed 10 years ago by exarkun

  • Keywords review added
  • Owner exarkun deleted

Ready for review in transitive-adaption-2199

comment:3 Changed 9 years ago by therve

  • Keywords review removed
  • Owner set to exarkun

Looks good, greatly improves test coverage. I was only wondering if the tests wouldn't be better in test_compat than in test_server. Anyway it should be merged.

comment:4 Changed 9 years ago by exarkun

  • Resolution set to fixed
  • Status changed from new to closed

(In [18666]) Merge transitive-adaption-2199

Author: exarkun Reviewer: therve Fixes #2199

Add tests for various adaption behaviors related to IResource and fix the implementation of to make these new tests pass.

comment:5 Changed 5 years ago by <automation>

  • Owner exarkun deleted
Note: See TracTickets for help on using tickets.