|
From: Michael F. <fuz...@vo...> - 2008-01-07 22:51:46
|
Stef Mientki wrote: > [snip...] >> ConfigObj is not *intended* to read in (or write out) non-standard types >> in unrepr mode. A way of extending unrepr mode for this would be nice (a >> way of recognising non standard types and reprs in the read/write >> phases), but as I don't use unrepr mode it would have to be implemented >> by someone else. It shouldn't actually be very hard - the difficult part >> is deciding on a clean and simple API (a dictionary of names mapping to >> types - although 'wx.Color' might be a problem because unrepr uses the >> Python parser and that is a dotted name rather than just a name). >> >> Your fix - to write the value out as a tuple if it can be converted is >> clever, but in general it might not 'do the right thing' when read back >> in. (For users who aren't aware of this behaviour.) In general I prefer >> to raise an exception than do clever tricks. >> >> For handling custom types you can use 'validate.py' and configspecs, but >> off the top of my head I don't think that they work well with unrepr mode. >> >> >> > Ok, that's all too complex for me (at least for now). > As I want to store fairly complex structures, with a lot of special classes, > I'm also not sure if this really solves everything. > Right. >> How about using the walk method to recursively change wx.Colour objects >> into tuples before writing? >> >> > never heard of walk, again too complex for now ;-) > Walk is just a recursive method for calling a function on all the members in a config. It is documented and probably underused. :-) Michael > So thanks again, > I'm glad to know that the work around I use is not completely nonsense ! > > cheers, > Stef Mientki > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > |