On Sun, Feb 20, 2011 at 07:53:31PM -0800, Jonathan Vanasco wrote:
> i'm trying to figure out some paradigms in pyramid
> 
> using the pyramid_sqla template...
> 
> if i have:
> 
>     @action(renderer='/account/test_a.mako')
>     def test_a(self):
>         return {'project':'myapp'}
> 
>     @action(renderer='/account/test_b.mako')
>     def test_b(self):
>         return {'project':'myapp'}
> 
> how can i do something like:
> 
>     def test_c(self):
>         if 1:
>             return self.test_a()
>         else:
>             return self.test_b()

I would do it this way:

    @action()
    def test_a(self):
        return render_to_response('/account/test_a.mako', {'project':'myapp'})

    @action()
    def test_b(self):
        return render_to_response('/account/test_b.mako', {'project':'myapp'})

    @action()
    def test_c(self):
        if 1:
            return self.test_a()
        else:
            return self.test_b()

Marius Gedminas
-- 
Perl is not a programming language, it's a natural language that
computers understand.

Better than people, for the most part.
                -- Steve Simmons

Attachment: signature.asc
Description: Digital signature

Reply via email to