Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion About Pyramid
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jonathan Vanasco  
View profile  
 More options Jun 20 2012, 10:26 am
From: Jonathan Vanasco <jonat...@findmeon.com>
Date: Wed, 20 Jun 2012 07:26:07 -0700 (PDT)
Local: Wed, Jun 20 2012 10:26 am
Subject: Re: About Pyramid

On Jun 20, 7:17 am, "Biswas, Pinakee" <pina...@vvidiacom.com> 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/?aw...
) 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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.