On Jun 20, 7:17 am, "Biswas, Pinakee" <[email protected]> wrote:

> 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.

Yes.

views in Pyramid are similar to Controllers in Pylons.

There is also a pyramid_handlers package (
http://docs.pylonsproject.org/projects/pyramid_handlers/en/latest/?awesome
) which largely emulates the Pylons style controllers.

Pyramid is a lot more configurable than Pylons, so you can have both
Pyramid views and pyramid_handlers controllers in the same application
if you want.

/views.py is just a file that was created by an application scaffold.

You can replace it with /views/__init__.py

It is only read when you `config.scan("cliquedin.views")` on
application startup ( usually in __init__.py or routes.py )


> 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?

Your Pyramid application is really just a Python package.  It expects
certain files in certain places, and those files to do certain things
-- but you have plenty of namespaces to work with.

I prefer to structure my lib folder like this:

/lib
/lib/handlers.py ( the base handler configuration that the views
inherit from )
/lib/helpers/ ( a directory for helper modules )
/lib/constants.py ( i have some constants that never change, like
States & countries )
/lib/forms.py ( i consolidate all my formencode forms, so i can re-use
them )
/lib/ext ( directory for external 3rd party code which isn't
installable by PyPi )


-- 
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.

Reply via email to