← Back to team overview

launchpad-dev team mailing list archive

Re: warning: we will soon have much noise in the test results...

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/26/2010 12:42 PM, Julian Edwards wrote:
> On Monday 26 July 2010 17:28:01 Aaron Bentley wrote:

> If there's no @classmethod on new() then you need an instantiated object.  At 
> that point, it's more likely that you've DTRT regarding <securedutility> 
> rather than circumventing the proxy by calling the classmethod.

Okay, point taken.  Though the scope where you can import Foo in order
to call Foo.new is already pretty restricted due to the importfascist.

> So, if I understand this stuff right, you simply don't need the @classmethod 
> if you call getUtility(IFoo).new()

The @classmethod means that you can register the class Foo, not
instances of the class Foo, as a utility, which means that you don't
need an instance of Foo in order to call Foo.new.

If you don't have an @classmethod on Foo, then you need an instance of
Foo in order to call Foo.new on it, and that's crazy.  So no classmethod
means you need to hang new() off a FooSet class instead of Foo.

Personally, I've always thought it was strange that we have to
instantiate these FooSet objects, since they don't have any state.  If
we keep on using them, I'd recommend using @classmethod/staticmethod on
them :-)

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxNvowACgkQ0F+nu1YWqI2idgCfc0999kOuJyzqSPk9/FKqhHJL
/O0An1HZI0xcSPIawQHdd1HhdnQPexS+
=GhRF
-----END PGP SIGNATURE-----



Follow ups

References