Im hacking around IEMethod and it uses an old style of class initialisation in the __init__.py along the lines of:
misc_ = { 'imagef':'foo','imageg':'goo', } lang_= { 'en':'lang_en','sv':'lang_sv', }
I want to put this into a modern style product initialisation (context.registerClass). Looking at this functions API it didn't become readily apparent how I can pass in these values. This would be nice to do so I don't have any hacking of dtml to do. Has anyone done this / got any advice?
Hi Andy - the modern product init doesn't currently provide any special handling of misc_ (though it probably should in the future to make registration an explicit operation). If a misc_ mapping is found in your __init__.py by the product initialization code, its items will be installed in the misc_ object of the top-level application object. So you'll want to do something like: from Globals import ImageFile misc_={'imagef': ImageFile('foo.gif', globals()), 'imageg': ImageFile('goo.gif', globals()), } When your product is initialized, the items in your misc_ will be installed in the application objects' misc_, and you can refer to them thereafter in your dtml as: <dtml-var BASEPATH1>/misc_/imagef <dtml-var BASEPATH1>/misc_/imageg etc. I don't know what 'lang_' does, so I'm not sure what to advise you there... Brian Lloyd brian@digicool.com Software Engineer 540.371.6909 Digital Creations http://www.digicool.com