On Apr 16, 2007, at 9:37 PM, rtconner wrote: > First thing is how does pylons handle view elements (re-usable pieces > of views, I guess)?
It depends on the template language. Myghty and Mako both treat every template as a 'component'. That is, you can define methods in each template that are to be used elsewhere, and in other template can call those re-usable chunks. The PylonsHQ website works like this, and has what I named a 'widgets.mako' template that has some re- usable bits that are re-used in the site. There's no reason to use a '.mako' extension, that was just how I did it. Here's the widgets template: http://pylonshq.com/project/pylonshq/browser/pylonshq/trunk/pylonshq/ templates/widgets.mako And a template using it: http://pylonshq.com/project/pylonshq/browser/pylonshq/trunk/pylonshq/ templates/paste/index.html Genshi has its own system to do something similar. > Second, say I just want to write a re-usable class or library. Where > would be the proper place to put this? As Pradeep mentioned, the lib/ dir is a good place to put modules you might want to re-use. However, for multiple apps, you might consider making your own package with the modules you want to re-use, and import them in your lib/base.py module for use in each app you write. HTH, Ben --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
