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? Thanks. -- Andy McKay.
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
Brian Lloyd etc. I don't know what 'lang_' does, so I'm not sure what to advise you there...
Hi Andy, As far as I can see the land_ directory doesn't seam to do anything. You could try to just remove it. (It wasn't me that put it there.) As for the most part of the Images defined in the misc_ structure, I suppose all of the except the IEMethod.gif (needed outside) could be defined in the IEMethod class instead of the module level. They are really not so useful outside the scope of the IEMethod object itself. This should apply to the JavaScript-files and CSS-files as well. (Well it was me who put those files there, but that was a long time ago ;-) Regards, Johan Carlsson
Lang is used in this line: document.write("<SCR"+"IPT src=\"misc_/IEMethod/lang_"+lang+"\" type=\"text/javascript\"></SCR"+"IPT>"); Kind of a bizarre line, but it looks like its setting the script source. Thanks, just doing a quick ZWiki-IEMethod merge so that you can edit a ZWiki standard style or using IEMethod. Thanks for the code. -- Andy McKay. ----- Original Message ----- From: "Johan Carlsson" <johanc@torped.se> To: <zope-dev@zope.org> Sent: Wednesday, January 24, 2001 8:44 AM Subject: Re: [Zope-dev] Old to new registerClass
Brian Lloyd etc. I don't know what 'lang_' does, so I'm not sure what to advise you there...
Hi Andy, As far as I can see the land_ directory doesn't seam to do anything. You could try to just remove it. (It wasn't me that put it there.)
As for the most part of the Images defined in the misc_ structure, I suppose all of the except the IEMethod.gif (needed outside) could be defined in the IEMethod class instead of the module level. They are really not so useful outside the scope of the IEMethod object itself. This should apply to the JavaScript-files and CSS-files as well. (Well it was me who put those files there, but that was a long time ago ;-)
Regards, Johan Carlsson
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
participants (3)
-
Andy McKay -
Brian Lloyd -
Johan Carlsson