[Coldbox 4.0] Render.RenderLayout and thread issue

When inside CFThread, Renderer.renderLayout() gets my layout from layoutsExternalLocation instead of my conventions location.

When I run it outside the thread, it works as expected.

Is there anything I can do about this? Is this expected behavior?

Thanks,

Tom.

That’s a very interesting behavior, Tom. Can you create a very simple site that demonstrates this behavior, zip it up, and create a ticket?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Actually, it doesn’t work outside the thread. This is the same issue as the one I mentioned a few days ago.

If you render a view/layout either using the renderer, or from another module, and add the module argument (“explicit module”), there is no way to get CB to do the view/layout parent lookup - so conventions are ignored.

I’ve got around this by altering Render.cfc and commenting out the following withing locateModuleView and locateModuleLayout:

if( len(arguments.module) and arguments.explicitModule ){
// I don’t want it to ever do this and there is no way around it!! return “#variables.modulesConfig[arguments.module].mapping#/#variables.modulesConfig[arguments.module].conventions.layoutsLocation#/#arguments.layout#”;
}

For the life of me I’ve no idea why anyone wouldn’t want parentLookup to do what it’s supposed to do if you’ve configured it in the moduleConfig. Perhaps people do want that.

As I mentioned to Luis, at least have an argument that forces a parent lookup when you explicitly specify the module…

For now, commenting out the above in both places makes it work as I want…

Tom, is there a ticket for this?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I submitted a pull: https://github.com/eBiz/coldbox-platform/commit/99d55fc193fc5f9d950e0a4e09b07fefd322df04#diff-c83408e1535911c615745536439e50f6

But that adds the optional argument, and it’s only for views as I didn’t know about the layout issue as it’s rare I want to render a module layout from another module.

Also, I’m not entirely convinced that the current behavior is correct in the first place, so perhaps a fix would be better?

But if I have to add an argument to my renders() then that’s preferable to changing CB core for each release which is what I’m doing at the moment…

Thanks,

Tom.

Ahh yes, that pull request. I thought this sounded familiar. I pinged Luis to look at the open pulls the other day. I’ll rattle his cage again.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Yeah this would be handy if it worked, I have run into this a few times and to get around it was a pain at times.