I use hash() not for security, but to 'normalize' the value of application name - to make sure it does not contain any problematic special characters, which getCurrentTemplatePath() may return (like 'C:\\some path\some.sub.path\my folder\etc etc etc\Application.cfc').
Azadi On Mon, Oct 15, 2012 at 9:20 PM, Nick Gleason <[email protected]> wrote: > > Hello Azadi, > Thanks for the feedback. Although I am interested in the extends attribute > of the cfc for this, that seemed a bit tricky. Since all I need in the > short run was to get the applicationname variable into application.cfc, I > did do something similar to what you suggest. > One question about the hash function in your example. Why would that be > necessary here? I'm not storing this in a database at this point so I'm > not sure if it's still necessary. > Thoughts? > Best, > Nick > > ............................................................................ > ..... > > Nick Gleason | CitySoft, Inc. | http://www.citysoft.com > > Direct: (617) 899-5395 | Fax: (617) 507-0444 > > Spend Less >> Do More - Community Enterprise combines great features with > an affordable price > > . > ............................................................................ > ..... > > > ---------------------------------------- > Return-Path: <[email protected]> > Received: from mail.houseoffusion.com [64.118.74.225] by > mail67.safesecureweb.com with SMTP; > Sun, 14 Oct 2012 19:28:02 -0400 > To: cf-talk <[email protected]> > Message-ID: > <CAFcZD6dP9NYjRtW6QVzen=penxrnowx4hw-6brii9jssp0h...@mail.gmail.com> > Subject: Re: Best practice question for Application.cfc > References: <4f9f30b3$2f548fd9$34618e3a$@com> > Date: Mon, 15 Oct 2012 08:27:46 +0900 > Precedence: bulk > Reply-To: [email protected] > From: Azadi Saryev <[email protected]> > MIME-Version: 1.0 > Content-Type: text/plain; charset="ISO-8859-1" > Content-Transfer-Encoding: 7bit > X-Rcpt-To: <[email protected]> > X-SmarterMail-Spam: SpamAssassin 0 [raw: 0], SPF_None, DK_None > X-SmarterMail-TotalSpamWeight: 0 > > If it is only applicationname that you need to be unique, then you > could just use a hash of template path as app name, or some variation > of the below: > > this.name = hash(getCurrenttTmplatePath()); > > Azadi > > On Sat, Oct 13, 2012 at 10:47 PM, Nick Gleason wrote: >> >> Hi Folks, >> We're moving from application.cfm to application.cfc and I had a > question >> regarding best practices. >> We re-use our base code and in the past, we have used a settings page > that >> is external from the base code and unique per client to set the >> applicationname variable (and other variables). This is called at the >> beginning of application.cfm and provides with the unique >> application name. >> That same structure seems to work with application.cfc but requires > calling >> a file at the top of application.cfc, above setting the application >> variables in application.cfc, to provide the applicationname. >> Is that approach (calling a file at the top of application.cfc to provide > a >> unique client setting) considered a best practice for this kind of > thing. >> Or, is there a more appropriate way? >> The only other thing I could think of would be to hard code the unique >> client applicationname in Application.cfc, but that would then require > that >> Application.cfc be a unique file per client and thus not part of our > core >> base code in the sense that we wouldn't include it in upgrades (so that > it >> wouldn't over-write a unique client file with default values). >> Any thoughts on that? Let me know if I'm not being clear. >> Thank you in advance! >> Nick >> >> >> >> >> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352911 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

