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?
On Jul 2, 3:10 pm, "Mike Orr" <[EMAIL PROTECTED]> wrote: > On Wed, Jul 2, 2008 at 2:38 PM, johnnyice <[EMAIL PROTECTED]> wrote: > > > I have code that accesses the model, but it shared by multiple > > controllers. In CakePHP this would be a component (small piece of > > code shared by controllers), but does that make sense in pylons? > > > If so i could just do: > > > from myappname.controllers.components import my_shared_code > > > What have others done? > > There's no official place, but good choices would be the base > controller, a subclass of the base controller, or a 'lib' module. > > It partly depends on whether it has to access 'self' (in which case it > can't be a function), and whether it has to access > request/response/session/render (which some people may feel > uncomfortable putting in a function). > > -- > 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 -~----------~----~----~----~------~----~------~--~---
