Back to index

plone3  3.1.7
__parent__.py
Go to the documentation of this file.
00001 import sys
00002 
00003 def __parent__(modulename, level=1):
00004     'Figure out parent module'
00005     for i in range(level):
00006         if not isinstance(modulename, basestring):
00007             modulename = modulename.__name__
00008         modulename = sys.modules['.'.join(modulename.split('.')[:-1])]
00009     return modulename