I've been playing around with MiscUtils.Configurable all morning without
luck, and was wondering if one of you could give me a hand.
The module I'm trying to use it in wasn't a class, but a collection of
smaller and unrelated functions I use throughout the rest of my site.
Looking through the docs and the Configurable module, it looked like I
needed to subclass it though, so this is what I came up with.
from MiscUtils.Configurable import Configurable
class Test(Configurable):
def configFilename(self):
return 'News.config'
def sql(self):
return self.settings('SQL_Server')
I had made a file called News.config in the correct folder. It looks
like this:
{
'SQL_Server': '127.0.0.1',
}
Then I used this;
blah = Test()
print blah.sql()
Webkit displayed the following error:
File "/library/webserver/cgi-
executables/webware/MiscUtils/Configurable.py", line 62, in setting
return self.config()[name]
KeyError: SQL_Server
If I try self.printConfig() it gives the error ValueError: min() or
max() arg is an empty sequence
Any idea what I'm doing wrong? I've tested the config file dictionary
out separately and it works correctly, so the only way I can see these
errors happening is if it is accessing the wrong file...
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss