I just tried and work well

In views/test.html

    {{=myvar}}
In views/default/test2.html

    {{=outstr}}

In controllers/default.py

def test2():  # note test2.html does not exist
    outstr = response.render('test.html',dict(myvar='MyVarTest'))
    return dict(outstr=outstr)

No layout. Just 'MyVarTest'

On Feb 1, 5:35 am, villas <villa...@gmail.com> wrote:
> After more experiments,  I have encountered some unexpected
> behaviour.  This is what I did:
>
> Create: test.html
>     {{=myvar}}
>
> def test():
>     response.render('test.html',dict(myvar='MyVarTest'))
>     return dict()
> Result ... default/test2:  MyVarTest  (OK and expected)
>
> def test():
>     outstr = response.render('test.html',dict(myvar='MyVarTest'))
>     return dict(outstr=outstr)
> Result ... default/test:  MyVarTest  (OK and expected)
>
> def test2():  # note test2.html does not exist
>     outstr = response.render('test.html',dict(myvar='MyVarTest'))
>     return dict(outstr=outstr)
> Result ... default/test2:  Layout is rendered  (hmm,  still OK because
> there is no default view?)
>
> Create:  test2.html  content is ABC
> Result ... default/test2:  ABC is rendered without layout  (OK because
> I didn't put 'outstr' in the view)
>
> Create:  test2.html  content is {{=outstr}}
> Result ... default/test2:  layout is rendered  (NOT OK,  I never asked
> for a layout)
>
> Problem is:  I cannot render test.html inside a controller named test2
> without getting a layout.  This was unexpected and maybe a bug?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to