[Zope3-dev] Re: another layers quicky?

Philipp von Weitershausen philipp at weitershausen.de
Tue Oct 17 12:23:42 EDT 2006


Chris Withers wrote:
> Hi (yet) again ;-)
> 
> class MyLayer:
> 
>   @classmethod
>   def setUp(self):
>     self.app = Testing.ZopeTestCase.Zope2.app()
> 
>   @classmethod
>   def tearDown(self):
>     Testing.ZopeTestCase.close()

Shrug! That will modify the class! "self" is the class here (it's 
convention to call it "cls" when using @classmethod).

> class MyTests(TestCase):
> 
>   def setUp(self):
>     self.savepoint = transaction.savepoint()
>     self.app = makerequest(?.app)
> 
>   def tearDown(self):
>     self.savepoint.rollback()
> 
>   ...
> 
> What do I put in place of the ? to get hold of the layer's app?

self.layer.app



More information about the Zope3-dev mailing list