[TransWarp] component config info

Joel Boehland joel at memes.com
Mon Feb 10 18:50:12 EST 2003


Hello Phillip,
Thanks for your explanation on loading 
config info for components. I just got 
it to work, and I thought I'd send a 
little code example to the list in case 
others aren't clear on this.

file conf/component.ini:
[mycomponent.dottedpath]
somekey="blah"


file componentconfigtest.py:

from peak.api import *

class ConfigComponent(binding.Component):
     def getKey(self):
         key = "mycomponent.dottedpath.somekey"	
         return 
self._getConfigData(key,self)

if __name__ == "__main__":
     cc = ConfigComponent()
     config.loadConfigFile(cc, 
"conf/component.ini")
     key = cc.getKey()
     print key #should print "blah"




More information about the PEAK mailing list