<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
regarding the generations issue, Christian brought me to the right way,
so I was able so solve this too.<br>
<br>
I made the following:<br>
<br>
cd src/example/<br>
mkdir generations<br>
cd generations<br>
touch __init__.py<br>
touch util.py<br>
touch install.py<br>
touch evolve1.py<br>
<br>
util.py:<br>
<br>
import grok<br>
from zope.generations.generations import SchemaManager<br>
from zope.generations.interfaces import ISchemaManager<br>
<br>
<br>
schemaManager = SchemaManager(<br>
minimum_generation=1,<br>
generation=1,<br>
package_name='example.generations'<br>
)<br>
<br>
<br>
grok.global_utility(<br>
schemaManager,<br>
provides=ISchemaManager,<br>
name="example",<br>
direct=True<br>
)<br>
<br>
install.py:<br>
<br>
from example.app import Example<br>
from zope.generations.utility import getRootFolder<br>
<br>
def evolve(context):<br>
root = getRootFolder(context)<br>
root['example'] = Example() #<- root['example'] is the
name of your Application displayed by the UI<br>
print "CREATED App example"<br>
<br>
<br>
evolve1.py:<br>
<br>
from zope.generations.utility import getRootFolder<br>
<br>
def evolve(context):<br>
root = getRootFolder(context)<br>
app = root['example']<br>
<br>
cd ../<br>
<br>
configure.zcml (example/src/example/configure.zcml):<br>
<br>
<include package="zope.generations" file="subscriber.zcml"/>
#<- NOT file="subscriptions.zcml"<br>
<br>
cd ../../ <br>
add zope.generations to global setup.py:<br>
<br>
example/setup.py:<br>
install_requires= [ ...<br>
'zope.generations', <br>
<br>
rerun buildout.<br>
<br>
running your application will display "CREATED App example" on startup.
UI displays example as installed application.<br>
<br>
Cheers Christian Schmidt<br>
<br>
<br>
<br>
<br>
<br>
<br>
Am 01/16/2012 14:51, schrieb Matt Rutherford:
<blockquote
cite="mid:CAGRtG9cJokOahDQEUPFoYoRdzMqwr7i21UVAydSQLa4QNztJ2g@mail.gmail.com"
type="cite">As he pointed out to me above, you need to add <font
face="arial, sans-serif" color="#222222">your new package 'mynewapp'
to the top-level setup.py's install_requires list, buildout again and
then it will appear as another option in the admin gui.</font>
<div><br>
<div class="gmail_quote">On 16 January 2012 13:33, Christian Schmidt <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:grok-list@creativenet.de">grok-list@creativenet.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello
Christian,<br>
<br>
first thank you for your reply. I followed your advice but like Matt i
have still the same problem for trying to add a second application.
Grok answers with the default app. Here is exactly what I did:<br>
<br>
grokproject example<br>
cd example/src<br>
../bin/paster create -t basic_package mynewapp<br>
<br>
This create a new package base stucture unter
example/src/mynewapp/mynewapp/<br>
<br>
__init__py.<br>
<br>
I added there<br>
<br>
app.py<br>
app_templates/<br>
static<br>
configure.zcml<br>
<br>
src/mynewapp/mynewapp/app.py:<br>
<br>
import grok<br>
<br>
#from example import resource<br>
<br>
class Mynewapp(grok.Application, grok.Container):<br>
pass<br>
<br>
class Index(grok.View):<br>
def render(self):<br>
<---->return "this is mynewapp"<br>
<br>
src/mynewapp/mynewapp/configure.zcml:
<div class="im"><br>
<br>
<configure xmlns="<a moz-do-not-send="true"
href="http://namespaces.zope.org/zope" target="_blank">http://namespaces.zope.org/zope</a>"<br>
xmlns:grok="<a moz-do-not-send="true"
href="http://namespaces.zope.org/grok" target="_blank">http://namespaces.zope.org/grok</a>"><br>
<include package="grok" /><br>
</div>
<includeDependencies package="." />
<div class="im"><br>
<grok:grok package="." /><br>
</configure><br>
<br>
</div>
finally i changed the example/buildout.cfg:<br>
<br>
develop = . src/mynewapp<br>
<br>
[app]<br>
eggs =<br>
added -> mynewapp<br>
<br>
AND<br>
<br>
site.zcml =<include package="mynewapp"/><br>
<br>
then ran bin/buildout<br>
<br>
returned:<br>
<br>
Develop: '/usr/home/chris_dev/example/.'<br>
Develop: '/usr/home/chris_dev/example/src/mynewapp'<br>
<br>
started the application and added mynewapp under UI:<br>
-> mynewapp (example.app.Example)<br>
<br>
<a moz-do-not-send="true"
href="http://127.0.0.1:8080/mynewapp/index" target="_blank">http://127.0.0.1:8080/mynewapp/index</a>
returned the default application.<br>
<br>
-> example/app_templates/<a moz-do-not-send="true"
href="http://index.pt" target="_blank">index.pt</a> (<a
moz-do-not-send="true" href="http://index.pt" target="_blank">index.pt</a>)<br>
<br>
If i change src/mynewapp/mynewapp/app.py: to -> Index1(grok.View):<br>
the page was not found.<br>
<br>
I would be thankful, if you have further ideas or solutions.<br>
<br>
Kind regard<br>
<br>
_______________________________________________<br>
Grok-dev mailing list<br>
<a moz-do-not-send="true" href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
<a moz-do-not-send="true"
href="https://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">https://mail.zope.org/mailman/listinfo/grok-dev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
</body>
</html>