Opened 14 years ago

Closed 14 years ago

#2895 enhancement closed fixed (fixed)

proxyForInterface should make it possible to specify the attribute name that the wrapped object is assigned to

Reported by: radix Owned by:
Priority: highest Milestone:
Component: core Keywords:
Cc: Jean-Paul Calderone Branch: branches/pfi-custom-attribute-2895-4
branch-diff, diff-cov, branch-cov, buildbot
Author: therve

Description

class Foo(proxyForInterface(IFoo, originalAttribute="result")):
    def blah(self):
        return self.result.blah() - 1

would be cool.

Change History (22)

comment:1 Changed 14 years ago by Jonathan Lange

This should be fixed before release so that we aren't lugging around another deprecated API.

comment:2 Changed 14 years ago by therve

Owner: changed from Glyph to therve

comment:3 Changed 14 years ago by therve

author: therve
Branch: branches/pfi-custom-attribute-2895

(In [21965]) Branching to 'pfi-custom-attribute-2895'

comment:4 Changed 14 years ago by therve

(In [21966]) Add the new attribute, and test the customization.

Refs #2895

comment:5 Changed 14 years ago by therve

Keywords: review added
Owner: therve deleted
Priority: normalhighest

That was easy :). Note that it's done without breaking anything, so first comment about deprecated API doesn't stand.

comment:6 Changed 14 years ago by therve

Keywords: review removed
Owner: set to therve

Waiting for #2901

comment:7 Changed 14 years ago by therve

Branch: branches/pfi-custom-attribute-2895branches/pfi-custom-attribute-2895-2

(In [21995]) Branching to 'pfi-custom-attribute-2895-2'

comment:8 Changed 14 years ago by therve

(In [21996]) Do it again.

Refs #2895

comment:9 Changed 14 years ago by therve

(In [21998]) Doc.

Refs #2895

comment:10 Changed 14 years ago by therve

Keywords: review added
Owner: therve deleted

Please review!

comment:11 Changed 14 years ago by therve

Keywords: review removed
Owner: set to therve

comment:12 Changed 14 years ago by therve

Branch: branches/pfi-custom-attribute-2895-2branches/pfi-custom-attribute-2895-3

(In [22139]) Branching to 'pfi-custom-attribute-2895-3'

comment:13 Changed 14 years ago by therve

Keywords: review added
Owner: therve deleted

Back to back to back to review.

comment:14 Changed 14 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to therve

Looks good. The only suggestion I have is that we may want to change the existing uses of proxyForInterface in Twisted to pass a sensible value for this new parameter.

Maybe see what jml thinks about that, since the existing uses are in trial.

Generally I think Twisted itself should never just use original, since the choice of name here is a free opportunity to make code easier to read.

comment:15 Changed 14 years ago by therve

Cc: Jean-Paul Calderone added

Do you think we should do it there or open another ticket?

comment:16 Changed 14 years ago by Jean-Paul Calderone

The branch isn't big now and adding this won't add much more, and fixing the uses in Twisted is the real motivation to make this change, so I think it's fine to do it here.

comment:17 Changed 14 years ago by therve

Branch: branches/pfi-custom-attribute-2895-3branches/pfi-custom-attribute-2895-4

(In [22279]) Branching to 'pfi-custom-attribute-2895-4'

comment:18 Changed 14 years ago by therve

Keywords: review added
Owner: therve deleted

Ready to review!

comment:19 Changed 14 years ago by radix

Owner: set to radix
Status: newassigned

comment:20 Changed 14 years ago by radix

Keywords: review removed
Owner: changed from radix to therve
Status: assignednew
  • Why B{}? I think C{} is more appropriate.
  • Also, given that the usages of proxyForInterface you changed didn't document their original attribute in the first place, it seems like it might be a good idea to give these original attributes names that start with _.

Other than that I'm happy with the branch.

comment:21 Changed 14 years ago by therve

Resolution: fixed
Status: newclosed

(In [22304]) Merge pfi-custom-attribute-2895-4

Author: therve Reviewers: radix, exarkun Fixes #2895

Add the possibility to proxyForInterface to specify the attribute where the proxied object is stored.

comment:22 Changed 11 years ago by <automation>

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