The amazing adventures of Doug Hughes

Well, yesterday Doug announced the news that I’d be helping them out part time as a contractor. I’m pretty excited about this as I feel like Alagad has one of the best teams out there in the world. Not only technically, but they are just darn good people at that. So I’m happy to be helping them out in some small way and especially pleased to work with Alagadians. (Speaking of which – when do I get my shirt?) I’m still plugging away hard at Broadchoice as well, so, let me just say I’m more than a bit booked. But the good thing about a lot of work is that it tends to generate a lot of good blogging ideas.

As an example, I can share with you this mistake that my friend, um, Bob, made when working on a Model-Glue application. I would never do anything this stupid, but it felt like that kind of thing others may do so I thought it made sense to share it with the world.

“Bob” had just added a new event to his Model-Glue.xml file. He fired off a call to a controller method that should have added some data to his view state. In order to keep it simple, here is an example using a view argument to demonstrate:

<event-handler name="page.test">
        <result do="view.template"/>
        <include name="body" template="dspTest.cfm">
            <argument name="foo" value="lando"/>

Notice the foo argument with lando value. In my view I then did:

<cfdump var="#viewState.getAll()#">

But for some reason, the foo value wasn’t there! I – sorry – Bob – spent a good half an hour reloading, restarting ColdFusion, etc, no luck.

Turns out the issue was simple. Duplicate events. Bob had defined two events named page.test. Model-Glue didn’t throw any error, it simply ignored the first event. I did a quick bit of testing to confirm that. I created 3 events, all with the same name, all using an argument named foo, and whichever event ran last seemed to win. Under Model-Glue 3 it worked the same as well. Can anyone think of a good reason why this would be allowed? Maybe an error should be thrown on startup?

Comments on: "Hi from a Jedi, and a stupid Model-Glue mistake" (2)

  1. zac spitzer said:

    the xml in modelglue really needs to be validated against a schema

    there are lots of gotcha’s with typos in the xml or wrong structures


    Check out the cool mini-game


Comments are closed.

Tag Cloud

%d bloggers like this: