Hi Massimo,
Can web2py support chaining response.files inside a component?
Scenario.
def component():
response.files.extend([
URL(..., 'fancy_helper1.js'),
URL(..., 'fancy_helper2.js'),
......,
URL(..., 'fancy_helper10.js'),
])
return {'': 'Some fancy stuff'}
def skeleton():
response.files.extend([
URL(..., 'fancy_helper1.js'),
URL(..., 'fancy_helper2.js'),
......,
URL(..., 'fancy_helper10.js'),
]) # SAME AS THOSE IN component(). Can I omit this?
return {'': LOAD('default', 'component.load', ajax=False)}
def index():
response.files.extend([
URL(..., 'fancy_helper1.js'),
URL(..., 'fancy_helper2.js'),
......,
URL(..., 'fancy_helper10.js'),
]) # SAME AS THOSE IN component(). Can I omit this?
return {'': LOAD('default', 'skeleton.load', ajax=False)}
Currently, if I add one more helper_extra.js into my fancy
component(), I needed to duplicate them into skeleton() and index().
It is not DRY. Can it be improved?
Regards,
Ray Luo (Iceberg)