|
From: Michael F. <fuz...@vo...> - 2008-11-24 02:01:14
|
Iain Murchland wrote: > Hi all, > > I have a need to specify a python class (as opposed to a string > referring to said class) as the value of a ConfigObj config variable. > > If I do so without importing the relevant module in the config file, > then I get a "configobj.UnreprError: Unknown name or type in value". If > I import the module at the start of the config file, then I get a parser > error, cos its not good config file syntax. > > I realise its a bit outside scope of a Win INI, but was hoping that > somebody might have had a similar problem before and know a solution. > > I'm afraid you can't do it within ConfigObj. Allowing it would allow the loading of a config file to trigger code execution, which is potentially unsafe and outside the scope of ConfigObj. You could pickle objects into strings and store them in ConfigObj which would also be pretty evil. Best to allow the storing of names corresponding to objects and turn it back into an object yourself. All the best, Michael > Thanks > Iain > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > -- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog |