Not tested, but should work.

in your controllers/default.py

response.view = "default/generic.%s" % request.extension

def index():
     return dict(message="Hello from index")

def contact():
     return dict(message="Hello from contact")


then, in your views folder create a generic file:
 "views/default/generic.html"

On that file put the content:

{{extend 'layout.html'}}
{{"""

You should not modify this file.
It is used as default when a view is not provided for your controllers

"""}}
<h2>{{=' '.join(x.capitalize() for x in request.function.split('_'))}}</h2>
{{if len(response._vars)==1:}}
{{=BEAUTIFY(response._vars.values()[0])}}
{{elif len(response._vars)>1:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{if request.is_local:}}
{{=response.toolbar()}}
{{pass}}


So you end using the same view for every function on that controller.



*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: WEB APPS THAT WORTH A
TRY<http://rochacbruno.com.br/web-apps-that-worth-a-try/>
  Get a signature like this.
<http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18>
Click
here.<http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18>



On Mon, Aug 20, 2012 at 5:25 PM, Toby Shepard <tshep...@rcsreg.com> wrote:

> I was thinking that it would be nice if I could
> make a director in the views folder matching a
> controller name, but then just put a file in there
> called 'generic.html' that would apply to any function
> called in that controller.
>
> Perhaps there is another way to do this.
>
> Thanks,
>
> Tobiah
>
> --
>
>
>
>

-- 



Reply via email to