On Wed, Jul 2, 2008 at 5:32 PM, johnnyice <[EMAIL PROTECTED]> wrote:
>
> it needs to take a few params from the calling controller.  this
> component itself doesn't need accesss to 'self', but it will need
> access to the db/models.  of course i would import that, but would it
> break the MVC pattern if i were to access a model from a lib?

There are differing opinions on that.  My opinion is that the model
should not depend on anything else in Pylons, but anything else can
use the model.  Although I try to avoid having the template look in
the model directly unless it's just a trivial constant.

My general rule is to import only the ORM classes, and to make class
methods for any queries needed or any non-ORM operations.  The Session
is imported only for writes (.save(), .delete(), .commit()).

So when I needed a a semi-generic auth library that uses three tables,
I put the integrity-checking function in the model because it depends
on several custom queries.  But the main auth code, which checks the
password and instantiates the User object containing the permissions,
is in a lib module.

-- 
Mike Orr <[EMAIL PROTECTED]>

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