[Checkins] SVN: gocept.selenium/branches/wosc-zodb-isolation/src/gocept/selenium/grok/fixtures.py Refactor grok test delegation
Wolfgang Schnerring
wosc at wosc.de
Sun Dec 26 09:30:03 EST 2010
Log message for revision 119132:
Refactor grok test delegation
Changed:
U gocept.selenium/branches/wosc-zodb-isolation/src/gocept/selenium/grok/fixtures.py
-=-
Modified: gocept.selenium/branches/wosc-zodb-isolation/src/gocept/selenium/grok/fixtures.py
===================================================================
--- gocept.selenium/branches/wosc-zodb-isolation/src/gocept/selenium/grok/fixtures.py 2010-12-26 14:27:30 UTC (rev 119131)
+++ gocept.selenium/branches/wosc-zodb-isolation/src/gocept/selenium/grok/fixtures.py 2010-12-26 14:30:03 UTC (rev 119132)
@@ -26,33 +26,29 @@
return '''<html><body>Hello from grok</body></html>'''
-# delegate to the common isolation fixture, but register the views grok-style
+class DelegatingView(grok.View):
+ # delegates actual functionality to the common isolation fixture, but lets
+ # us register the views grok-style
-class Set(grok.View):
- grok.name('set.html')
grok.context(object)
def render(self):
- view = gocept.selenium.tests.fixture.dummy.Set()
+ view = getattr(
+ gocept.selenium.tests.fixture.dummy, self.__class__.__name__)()
view.context = self.context
return view()
-class Get(grok.View):
+class Set(DelegatingView):
+
+ grok.name('set.html')
+
+
+class Get(DelegatingView):
+
grok.name('get.html')
- grok.context(object)
- def render(self):
- view = gocept.selenium.tests.fixture.dummy.Get()
- view.context = self.context
- return view()
+class IncrementVolatile(DelegatingView):
-class IncrementVolatile(grok.View):
grok.name('inc-volatile.html')
- grok.context(object)
-
- def render(self):
- view = gocept.selenium.tests.fixture.dummy.IncrementVolatile()
- view.context = self.context
- return view()
More information about the checkins
mailing list