Hi Jonathan, Mike and Parnell,

Thanks for your prompt responses and the detailed explanations. They
certainly would help in designing our platform.

 

Thanks,

Pinakee



 

P Please don't print this e-mail unless you really need to, this will
preserve trees on planet earth. 

----------------------------Disclaimer--------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
---------

The information contained in this message (including any attachments) is
confidential and may be privileged. If you have received it by mistake
please notify the sender by return e-mail and permanently delete this
message and any attachments from your system. Please note that e-mails are
susceptible to change and malwares. VVIDIA COMMUNICATIONS PVT LTD.
(including its group companies) shall not be liable for the improper or
incomplete transmission of the information contained in this communication
nor for any delay in its receipt or damage to your system. 

----------------------------------------------------------------------------
---------------------------------------------Disclaimer---------------------
----------------------------------------------------------------------------
---------

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Parnell Springmeyer
Sent: 20 June 2012 23:33
To: [email protected]
Subject: Re: About Pyramid

 

1.       I think there is no controller in Pyramid and I think the Views
probably plays the role (for what is there in Pylons). In Pylons, I could
have multiple controllers (or python files/modules in controller folder to
say in crude way). I think in Pyramid, it would probably be the same (new
python modules) but route needs to be defined. The view.py is provided when
a Project is created.

 

Views can be structured any way you want. You can create classes and make
the views methods of the classes (using the @view_config decorator) in their
own separate .py files; you can make them plain python functions with the
@view_config decorator or declare them with the configurator in the __init__
module; you could clump them all up into one .py file, into separate .py
files, etc.

 

It's really up to you and how big your application is.

 

I personally have 90% of the "controllers" separated into their own modules.
So for my user's billing page, there is a "view" module named "billing.py"
and inside of it is a class "class BillingView" that extends a base view.
Inside the class is all of the "view" methods, like update, display, etc...

 

You can name the class whatever you want, it isn't significant - only to
you, the programmer. I like the class based way because I can extend it with
a base class that can provide a number of useful abstract methods and
members.

 

I have a few views that are just straight python functions with a
@view_config decorating it. These I will typically clump into a module based
on shared functionality. So I have a lot of custom error handling views
(like 4 or 5) and they are all in a "errors.py" module. Same with any others
that are composed that way.

 

I also use traversal, so I have a separate resources.py module that defines
*all* of my traversal object trees.





2.       In Pylons, lib folder contained 3rd party code and any other code
that doesn't fit in the main application. Is there anything similar in
Pyramid? Or any similar convention?

 

I put 3rd party code inside a directory called "libraries" so:
pyramid/myapp/libraries right alongside it is a directory called "views",
"templates", "models", &c.

 

Hope that helps!!! I may write a blog post on how I've structured my Pyramid
app, as I see this type of question a lot and I'm using Pyramid in a heavy
production environment very successfully.

 

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.

<<image001.png>>

Reply via email to