Hi Paul, thanks for clearing this out for me,
However I have a couple of confusions which I have added in-line to your
reply.
On Wednesday 11 November 2015 05:21 PM, Paul Everitt wrote:
When you are starting, most people define their routes in their
__init__ main() function, and their views in a views.py module which
they read with config.scan(‘.views’). You can go a LONG way with just
this. Feel free to stop reading at this point. :)
:) Well, My application is big enough so I have to stop reading at this
point.
Later, people start organizing their code base by component: a todo
directory, a user directory, etc. Each of those then have a views.py
module in them. However, they still leave the route definition in the
top-level __init__.py, to control ordering.
Oh, don't understand this, because I would still need scanning right?
So do I scann packages or individual files, as in package/module?
And I would like to know if I have to do the double work of first
writing the roots and then also do the
@view_config(route_name=view_name)?
This is a different query all together and I did mail it on a different
thread, but now that we are discussing, I thought of asking this.
The Reason I am asking is can I just use config.add_view and not write
roots at all?
After that, though, there is a further level of Pyramid zen:
- Have a todo/__init__.py with an includeme function, which is the
single place for wiring up everything in the todo subpackage
- The includeme function does the view registration
So again the same question, will I have to do the double work under this
situation or will I just do config.ad_view() in the includeme function?
- It *also* does route definition
- The top-level package then pulls in todo etc. using config.include
with a route prefix to avoid ordering and collision problems:
So the top level package will still need roots is it?
My condition is very simple, I will just have a single package with many
modules, each being a class based view.
For example a view_voucher.py having add, update, insert and delete (aka
crud ) system.
Similarly there will be a view_user, view_account view_product etc.
So I am trying to figure out how a single package can be scanned, or do
I have to write individual config.add_view statements for all my
package/module/view_function or class?
I am sorry if I am sounding too naive, but have used Pylons before and
the system was very simple, there used to be a controllers directory and
I had all my controller modules/classes there.
Happy hacking.
Krishnakant.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.