Hi,
On 15-Dec-06, at 11:49 AM, [EMAIL PROTECTED] wrote:
>
> Hi guys!
>
> I'm a webware user and I want to test newer tecnologies, I like the
> way
> cherrypy works and I was between turbogears and pylons, so I want to
> give a try to turbogears. My goal is to port a large system build over
> webware to turbogears. Well, I think I will have many question with
> the
> time :D
I haven't used webware myself, but welcome to TurboGears. :)
>
> The first one is about controllers.py. I like to organize my sites in
> subsections, as above:
>
> /site
> /about
> /services
> /admin
Do you need each of those subparts (about, services, admin) to be
a complex hirarchy of pages, or just a single page each?
So will you have /admin/foo, /admin/bar, /admin/baz/xy,
or will users just have an admin page under /admin?
> I try to do an arrange like this in tg and I was sucessfull with 2
> methods, the first one is...
>
> . class Admin(controllers.RootController):
> . @expose(template='cheetah:saraswati.templates.admin.index')
> . def index(self):
> . return {}
> .
> . class Root(controllers.RootController):
> . @expose(template="cheetah:saraswati.templates.index")
> . def index(self):
> . return {}
> .
> . admin = Admin()
>
> ... and the second one:
>
> . class Root(controllers.RootController):
> . @expose(template="cheetah:saraswati.templates.index")
> . def index(self):
> . return {}
> .
> . class Admin(controllers.RootController):
> . @expose(template='cheetah:saraswati.templates.admin.index')
> . def index(self):
> . return {}
> . admin = Admin()
>
> ... And I think I could suppress the "admin = Admin()" line and get
> the
> class autocall itself:
>
> . class Root(controllers.RootController):
> . @expose(template="cheetah:saraswati.templates.index")
> . def index(self):
> . return {}
> .
> . class admin(controllers.RootController): # admin will autocall
> itself
> . @expose(template='cheetah:saraswati.templates.admin.index')
> . def index(self):
> . return {}
Any of those ways should be fine, and doesn't really affect your
application,
it's a matter of style. Personally I like the first one (where you
declare Admin
outside the Root class) because I find it easier to read. When you
start stacking
a lot of inner class and method declarations you get into indentation
hell. :)
But if you only have 2 levels you should be fine.
Another thing to point out is that if you don't have sub-hierarchies
under /admin
you could make it a method instead of a class.
>
> What do you think? I have another question too. If I have 2
> independent
> project, suppose one is the site project and the other one is a pool
> application. Is there a way to integrate the pool application inside
> the site project. I think I can because I can insert another
> controller
> inside the root controller, am I right?
I'm not entirely sure what you mean here.
Igor
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---