[BlueBream] automatically-create-some-needed-object-at-application-startup (ok) but how print view ?
zizou afix
ziz.root at gmail.com
Fri Aug 13 10:30:56 EDT 2010
hi, i continue my user experimentation
but I was certainly not understood an important concept
I tested the issue of this faq :
http://bluebream.zope.org/doc/1.0/faq.html#how-do-i-automatically-create-some-needed-object-at-application-startup
it's ok, it create my object.
but I can not find how use it with the <browser:page for="?????" /> in
configure.zcml
Thanks for your help
below my files
##################
# file : test_path.py #
##################
from zope.app.appsetup.interfaces import IDatabaseOpenedWithRootEvent
from zope.app.appsetup.bootstrap import getInformationFromEvent
import transaction
from zope.component import adapter
from zope.container.btree import BTreeContainer
class MyContainer(BTreeContainer):
pass
@adapter(IDatabaseOpenedWithRootEvent)
def create_my_container(event):
db, connection, root, root_folder = getInformationFromEvent(event)
if 'test_path_dir' not in root_folder:
root_folder['test_path_dir'] = MyContainer()
transaction.commit()
connection.close()
#----------------------------------------------------------------------------------------------------
####################
# file : myhello.py #
####################
from zope.publisher.browser import BrowserView
class HelloView(BrowserView):
def __call__(self):
return "Hello World!"
####################
# file : configure.zcml #
####################
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="mydomain">
<include file="securitypolicy.zcml" />
<browser:page
for="???????????????????????????" <!-- here i don't know what i
have to write to have http://localhost:8080/test_path_dir/hello -->
name="hello"
permission="zope.Public"
class=".myhello.HelloView"
/>
<subscriber handler=".spectacles.create_my_container" />
<browser:defaultView
for="zope.container.interfaces.IContainer"
name="index"
/>
<include package=".welcome" />
</configure>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/bluebream/attachments/20100813/57567b19/attachment.html
More information about the bluebream
mailing list