[Grok-dev] Re: paster vs grokproject
Tim Terlegård
tim.terlegard at gmail.com
Tue Jan 29 15:30:17 EST 2008
On Jan 29, 2008, at 4:21 PM, Philipp von Weitershausen wrote:
> Tim Terlegård wrote:
>>
>> I think the local command feature of paster can be used to make
>> stuff easier for beginners. For instance someone asked on #grok
>> where he should put his new app. You need to add stuff to setup.py,
>> buildout.cfg and then create these files in src/newapp. It's not
>> obvious what to do.
>
> I don't understand the problem. Why couldn't this person have used
> grokproject?
With 'app' I mean a python package that contains an app.py and a
class that inherits from grok.Application. grokproject doesn't create
those
as far as I know, it just creates the initial one.
>> I would like to do like this:
>> $ cd /tmp
>> $ paster create -t grokproject MyCoolProject
>> $ cd MyCoolProject
>> $ paster create app sampleapp
>> When creating the sample app it adds what is added today with
>> grokproject when you create the new project, but it also adds the
>> python package to setup.py, configure.zcml, buildout.cfg or
>> whereever it's necessary.
>
> Can you elaborate what you mean by 'app'? Do you want multiple
> packages or multiple eggs within a project? What's the problem with
> creating multiple projects? Can you contrast what you currently have
> to do to achieve whatever you're trying to achieve vs. what you'd
> like it to look like?
Now we have this 'app' discussion again :) it's such an evil word.
To me grokproject creates a 'project' and in src it creates an 'app'
with the same name as the project.
As far as I know there's no grokproject switch to create another
app than the initial one. If I want to add a new app to the project
I'd do something like:
$ cd MyProject/src
$ mkdir newapp
$ cp initialapp/__init__.py newapp/
$ cp initialapp/app.py newapp/
$ cp-r initialapp/app_templates newapp/
$ cp initialapp/configure.zcml newapp/
$ cp initialapp/ftesting.zml newapp/
$ cp initialapp/testing.py newapp/
$ edit setup.py and buildout.cfg
Perhaps I misunderstood 'app'. Is there only supposed to be one
app (grok.Application) on a website?
So let's just call it a python package. I may want to split up a website
in several pckages. If I don't need more than one app.py and one
app_templates there are still some files left that I have to copy and
edit.
That's why I think it'd be nice with a local command that creates these
files.
> paster create -t plone3buildout
> cd MyPloneApp
> paster contenttype FooDocument
>
> While this is nice for Plone/Zope3 where writing a content type
> involves a bunch of different things (interface, class, ZCML, CMF
> registry, etc.), I hope that it's easy enough with Grok that we
> won't need this kind of automation. If we needed it, we should think
> about making Grok easier in the relevant places.
I agree, for most stuff we shouldn't need a tool that generates files.
But when creating a new python package there are obviously some
files that needs to be added. You probably create those files in a
second, but beginners might not now which file is needed and
which is not. And I would be glad if I didn't have to copy those files.
/Tim
More information about the Grok-dev
mailing list