Hi :)
I would like to run one app on more domains and allow users to apply
per-domain specific skins. E.g. default/index.html should be extending
layout_xyz.html for domain xyz.com, but layout_abc.html for domain abc.com.
As covered in the documentation, conditional {{extend}} does not work.
So, as an alternative, I tried to remove {{extend}} from
fuction-specific view files (e.g. default/index.html) completely, add
{{extend}} programmatically in the controller, such as:
fpath = request.folder+'views/'
extendtempl = 'layout_xyz.html'
myfile = open(fpath+fname, "r")
content="{{extend '%s'}}\n" % extendtempl + myfile.read()
myfile.close()
from gluon.template import render
return render(content=content, context=dict(), path=fpath)
But it raises an error:
return render(content=content, context=dict(), path=fpath)
File "/opt/web2py/gluon/template.py", line 906, in render
exec(code) in context
File "<string>", line 2, in <module>
NameError: name 'request' is not defined
The error refers to the very beginning of template.py:
if False:
from gluon import db, auth, crud
from gluon import *
request = current.request
Please, is there a different (proper) way to call view rendering
directly from a controller?
Relevant threads:
https://groups.google.com/forum/#!topic/web2py/AjefSkUoe5g
https://groups.google.com/forum/#!msg/web2py/iG48JpZj9d4/FzwBrUMCbKcJ
https://groups.google.com/forum/?fromgroups=#!topic/web2py/yBBhvADGGB4[1-25]
Thank you!
David
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.