From: Jamie C. <jca...@we...> - 2003-10-23 22:53:58
|
On Fri, 2003-10-24 at 08:30, Carsten wrote: > Hello, > i currently write a Usermin/Webmin module with the python-webmin api > from http://www.cendio.se/~peter/python-webmin/ > I had to make some changes in mscstyle3/theme.py to use it in Usermin, > but not very much, so it can be simply used in Usermin and Webmin, by > changing one var (for one if/else case) > Is there way of (auto) detecting if the theme file (or a module) is used > in Webmin or in Usermin? > (I know, that there is the programname in the language files, but i that > might not always work) The method I usually use is to have two separate module.info files, one for the webmin module and one for usermin. The usermin file has usermin=1 in it, while the webmin file does not. Your code can then check for this, and behave appropriately. In perl web/usermin modules this is really easy - the global hash %module_info contains all the optoins from module.info for the current module, so you can use code like : if ($module_info{'usermin'}) { # usermin stuff } else { # webmin stuff } - Jamie |