[Checkins] SVN: grokui.base/trunk/src/grokui/base/README.txt the template registry want module info now for view components
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Tue Dec 7 10:59:33 EST 2010
Log message for revision 118748:
the template registry want module info now for view components
Changed:
U grokui.base/trunk/src/grokui/base/README.txt
-=-
Modified: grokui.base/trunk/src/grokui/base/README.txt
===================================================================
--- grokui.base/trunk/src/grokui/base/README.txt 2010-12-07 15:50:20 UTC (rev 118747)
+++ grokui.base/trunk/src/grokui/base/README.txt 2010-12-07 15:59:33 UTC (rev 118748)
@@ -31,16 +31,19 @@
We can build a simple admin screen that fits into the environment like
this:
+ >>> from martian.testing import FakeModule
>>> import grokcore.viewlet as grok
>>> from zope.interface import Interface
>>> from grokui.base import GrokUILayer
- >>> class MyAdminScreen(grok.View):
- ... grok.layer(GrokUILayer)
- ... grok.name('helloadmin')
- ... grok.context(Interface)
- ... def render(self):
- ... return u'Hello admin!'
+ >>> class mymodule(FakeModule):
+ ... class MyAdminScreen(grok.View):
+ ... grok.layer(GrokUILayer)
+ ... grok.name('helloadmin')
+ ... grok.context(Interface)
+ ... def render(self):
+ ... return u'Hello admin!'
+ >>> from martiantest.fake.mymodule import MyAdminScreen
The important thing here is, that we set our view to belong to the
GrokUI namespace, which is named ``++grokui++`` in URLs.
@@ -86,21 +89,22 @@
>>> from grokui.base.layout import GrokUIView
>>> from grokui.base.namespace import GrokUILayer
- >>> class CaveManagementScreen(GrokUIView):
- ... # Name where we can access this page via URL:
- ... grok.name('managecave')
- ... # Also optional, but highly recommended:
- ... grok.require('zope.ManageServices')
- ... # Set title of page in menu bar:
- ... grok.title('admin stuff')
- ... # Display this entry very far to the left in menu bar:
- ... grok.order(-1)
+ >>> class mymodule(FakeModule):
+ ... class CaveManagementScreen(GrokUIView):
+ ... # Name where we can access this page via URL:
+ ... grok.name('managecave')
+ ... # Also optional, but highly recommended:
+ ... grok.require('zope.ManageServices')
+ ... # Set title of page in menu bar:
+ ... grok.title('admin stuff')
+ ... # Display this entry very far to the left in menu bar:
+ ... grok.order(-1)
...
- ... def render(self):
- ... # Instead of render() we could also define a page template
- ... # for the actual contents of this page.
- ... return u'Hello cave manager!'
-
+ ... def render(self):
+ ... # Instead of render() we could also define a page template
+ ... # for the actual contents of this page.
+ ... return u'Hello cave manager!'
+ >>> from martiantest.fake.mymodule import CaveManagementScreen
>>> grok_component('CaveManagementScreen', CaveManagementScreen)
True
More information about the checkins
mailing list