On Apr 16, 2010, at 5:13 PM, mdipierro wrote:

> Not quite.
> 
> {{extend name}} without quote is supported by name has to be a
> variable containing the name of the template. This allows to have
> templates determined dynamically based on user for example.

So instead of {{extend request.layout}}, what?

Can I do:

{{layout = request.layout}}
{{extend layout}}

?

Note that {{extend request.layout}} works fine in normal operation. It only 
breaks when I try to compile the app, because request isn't defined for the 
eval().


> 
> On Apr 16, 5:24 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
>> On Apr 16, 2010, at 2:11 PM, Jonathan Lundell wrote:
>> 
>> 
>> 
>>> I have several questions regarding app compiles, but the first one is this:
>> 
>>> Error traceback
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>> 14.
>>> 15.
>>> 16.
>>> 17.
>>> 18.
>>> 19.
>>> Traceback (most recent call last):
>>>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/restricted.py", line 
>>> 173, in restricted
>>>     exec ccode in environment
>>>   File 
>>> "/Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py",
>>>  line 1061, in <module>
>>>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/globals.py", line 96, 
>>> in <lambda>
>>>     self._caller = lambda f: f()
>>>   File 
>>> "/Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py",
>>>  line 213, in compile_app
>>>     c = app_compile(request.args[0], request)
>>>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/admin.py", line 141, 
>>> in app_compile
>>>     compile_application(folder)
>>>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py", line 
>>> 520, in compile_application
>>>     compile_views(folder)
>>>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py", line 
>>> 293, in compile_views
>>>     data = parse_template(file, path)
>>>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/template.py", line 
>>> 139, in parse_template
>>>     t = os.path.join(path, eval(match.group('name'), context))
>>>   File "<string>", line 1, in <module>
>>> NameError: name 'request' is not defined
>>> The match in question is presumably {{extend request.layout}}, right?
>> 
>> OK, that's what I changed. Because I was experimenting with layouts, I 
>> changed {{extend 'layout.html'}} to {{extend request.layout}}, which I 
>> assumed would work because request appears to be defined in views. But it's 
>> not defined in the context of the extend logic's eval().
>> 
>> It seems like a reasonable thing to be able to do....
>> 
>> --
>> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


Reply via email to