[Seaside] Accessing configuration values from the configuration

William E Harford seaside at harford.org
Thu Jul 21 21:55:42 CEST 2005


I have subclassed WASystemConfiguration as IOSContainerConfiguration

I overwrote #attributes as follows ...

attributes
	| attribs numberAttrib attribValue |
	numberAttrib _  (WAStringAttribute key: #numberOfContainers group:
#containers) .
	attribValue _ self localConfiguration valueAt: #numberOfContainers.
	Transcript show: attribValue.
	attribs _ Array new: ((attribValue) +1) .
	attribs at: 1 put: numberAttrib .

	2 to: (attribValue +1) do:[:index |
		attribs at: index put: 
			((WAListAttribute key: (('containerComponentNumber',(index -
1)asString) asSymbol) group: #containers) 
			options: self containerComponents) .
	].

	^attribs

attribValue is always 1 (the default)

I am running Seaside2.6a1. 



On Thu, 2005-07-21 at 11:38 -0700, Julian Fitzell wrote:
> William E Harford wrote:
> > If there any way to access a site's user inputted configuration values 
> > from a subclass of WASystemConfiguration ?
> > 
> > What I am trying to do is present the site administrator with a series 
> > of questions in the config biased on  answers that were given in the 
> > config.
> > 
> > For example
> > 
> > In this application there might be 3 components. The administrator would 
> > put the number 3 for a config value than save the config.
> > 
> > The config might than ask for the 3 component classes and there names.
> > 
> > I have only been able to retrieve the default values for a 
> > SystemConfiguration using.
> > 
> > self localConfiguration valueAt: #numberOfContainers.
> > 
> > 
> > I have to admit even though I have read a couple notes on seasides 
> > config component I still don't fully understand how it works.
> 
> Hmm... I would definitely expect that code to return the user's value if 
> there is one, otherwise it would return the default.  I just tried it 
> quickly in a 2.5a image I had lying around and it certainly seemed to 
> work as expected.  Am I understanding you correctly that you're always 
> getting back the default value even if the user has put in a value? 
> Perhaps you could provide a bit more of the code for context...
> 
> Julian
> 
-- 
William Harford <will at harford.org>



More information about the Seaside mailing list