Exemple #1
0
def __bootstrap():
    import sys, zlib, marshal
    from reportlab.lib.rl_accel import asciiBase85Decode
    from reportlab.lib.utils import rl_exec
    mname = 'reportPackages.rlextra.rml2pdf.rml2pdf_%d%d%s' % (
        sys.version_info[:2] + ('c' if not sys.flags.optimize else 'o', ))
    print(mname)
    m = {}
    rl_exec('import %s as m' % mname, m)
    m = m['m']
    c = sys.modules[__name__]
    N = dict([(a, getattr(c, a))
              for a in '__file__ __name__ __path__ __package__'.split()
              if hasattr(c, a)])
    if zlib.decompress(asciiBase85Decode(
            m.__code__)).find(b'(ReportLab PLUS)'):
        print("HERE")
    code = zlib.decompress(asciiBase85Decode(m.__code__))
    code = code.replace(b"ReportLab PLUS", len(b"ReportLab PLUS") * b" ")
    code = code.replace(b"Evaluation copy", len(b"Evaluation copy") * b" ")
    code = code.replace(b"Contact ReportLab", len(b"Contact ReportLab") * b" ")
    code = code.replace(b"(www.reportlab.com)",
                        len(b"(www.reportlab.com)") * b" ")
    code = code.replace(b"to purchase", len(b"to purchase") * b" ")

    rl_exec(marshal.loads(code), c.__dict__)
    c.__dict__.update(N)
    del sys.modules[mname]
Exemple #2
0
def _BCW(doc, codeName, attrMap, mod, value, **kwds):
    """factory for Barcode Widgets"""
    _pre_init = kwds.pop("_pre_init", "")
    _methods = kwds.pop("_methods", "")
    name = "Barcode" + codeName
    ns = vars().copy()
    code = "from %s import %s" % (mod, codeName)
    rl_exec(code, ns)
    ns["_BarcodeWidget"] = _BarcodeWidget
    code = (
        """class %(name)s(_BarcodeWidget,%(codeName)s):
\t_BCC = %(codeName)s
\tcodeName = %(codeName)r
\tdef __init__(self,**kw):%(_pre_init)s
\t\t_BarcodeWidget.__init__(self,%(value)r,**kw)%(_methods)s"""
        % ns
    )
    rl_exec(code, ns)
    Klass = ns[name]
    if attrMap:
        Klass._attrMap = attrMap
    if doc:
        Klass.__doc__ = doc
    for k, v in kwds.items():
        setattr(Klass, k, v)
    return Klass
def importModule(mName, fails=None):
    '''return a module given the import name ie reportlab.lib.utils or whatever'''
    o, e = sys.stdout, sys.stderr
    cwd = os.getcwd()
    if _ofile: t0 = time.time()
    try:
        try:
            _NS = {}
            rl_exec('import %s as __x__' % mName, _NS)
            if _ofile:
                t = time.time()
                print('##### import',
                      mName,
                      'OK %.3f %.3f' % (t - t0, t - _tg0),
                      file=_ofile)
            return _NS['__x__']
        except:
            if _ofile:
                t = time.time()
                print('!!!!! import',
                      mName,
                      'FAILED %.3f %.3f' % (t - t0, t - _tg0),
                      file=_ofile)
                try:
                    traceback.print_exc(None, _ofile)
                except:
                    print('!!!!! traceback failure', file=_ofile)
            if fails is not None: fails.append(mName)
            return None
    finally:
        if cwd != os.getcwd(): os.chdir(cwd)
        sys.stdout, sys.stderr = o, e
Exemple #4
0
def importModule(mName,fails=None):
	'''return a module given the import name ie reportlab.lib.utils or whatever'''
	o, e = sys.stdout, sys.stderr
	cwd = os.getcwd()
	if _ofile: t0 = time.time()
	try:
		try:
			_NS = {}
			rl_exec('import %s as __x__'%mName,_NS)
			if _ofile:
				t = time.time()
				print('##### import',mName,'OK %.3f %.3f' % (t-t0, t-_tg0), file=_ofile)
			return _NS['__x__']
		except:
			if _ofile:
				t = time.time()
				print('!!!!! import',mName,'FAILED %.3f %.3f' % (t-t0, t-_tg0), file=_ofile)
				try:
					traceback.print_exc(None,_ofile)
				except:
					print('!!!!! traceback failure',file=_ofile)
			if fails is not None: fails.append(mName)
			return None
	finally:
		if cwd!=os.getcwd(): os.chdir(cwd)
		sys.stdout, sys.stderr = o, e
Exemple #5
0
	def func(URL,modulename):
		try:
			NS = {}
			rl_exec('import %s as mod' % modulename,NS)
			mod = NS['mod']
			del NS
			from urllib.parse import urlparse, urlunparse
			host = urlparse(findSVNURL(path_dirname(mod.__file__)),allow_fragments=0)
			url = urlparse(URL)
			return urlunparse((url[0],host[1])+url[2:])
		except:
			return URL
Exemple #6
0
def _errorDump(fontName, fontSize):
    s1, s2 = list(map(str, exc_info()[:2]))
    from reportlab import rl_config
    if rl_config.verbose >= 2:
        import os
        _ = os.path.join(os.path.dirname(rl_config.__file__), 'fonts')
        print('!!!!! %s: %s' % (_, os.listdir(_)))
        for _ in ('T1SearchPath', 'TTFSearchPath'):
            print('!!!!! rl_config.%s = %s' % (_, repr(getattr(rl_config, _))))
    code = 'raise RenderPMError("Error in setFont(%s,%s) missing the T1 files?\\nOriginally %s: %s")' % (
        repr(fontName), repr(fontSize), s1, s2)
    if isPy3: code += ' from None'
    rl_exec(code, dict(RenderPMError=RenderPMError))
Exemple #7
0
def __bootstrap():
    import sys, zlib, marshal
    from reportlab.lib.rl_accel import asciiBase85Decode
    from reportlab.lib.utils import rl_exec
    mname = 'rlextra.utils.ubold_%d%d%s' % (sys.version_info[:2]+('c' if not sys.flags.optimize else 'o',))
    m = {}
    rl_exec('import %s as m' % mname, m)
    m = m['m']
    c=sys.modules[__name__]
    N=dict([(a,getattr(c,a)) for a in '__file__ __name__ __path__ __package__'.split() if hasattr(c,a)])
    rl_exec(marshal.loads(zlib.decompress(asciiBase85Decode(m.__code__))),c.__dict__)
    c.__dict__.update(N)
    del sys.modules[mname]
def __bootstrap():
    import sys, zlib, marshal
    from reportlab.lib.rl_accel import asciiBase85Decode
    from reportlab.lib.utils import rl_exec
    mname = 'rlextra.pageCatcher.pageCatcher_%d%d%s' % (sys.version_info[:2]+('c' if not sys.flags.optimize else 'o',))
    m = {}
    rl_exec('import %s as m' % mname, m)
    m = m['m']
    c=sys.modules[__name__]
    N=dict([(a,getattr(c,a)) for a in '__file__ __name__ __path__ __package__'.split() if hasattr(c,a)])
    rl_exec(marshal.loads(zlib.decompress(asciiBase85Decode(m.__code__))),c.__dict__)
    c.__dict__.update(N)
    del sys.modules[mname]
Exemple #9
0
def _defaults_init():
    '''
    create & return defaults for all reportlab settings from
    reportlab.rl_settings.py
    reportlab.local_rl_settings.py
    reportlab_settings.py or ~/.reportlab_settings

    latter values override earlier
    '''
    from reportlab.lib.utils import rl_exec
    import os

    _DEFAULTS={}
    rl_exec('from reportlab.rl_settings import *',_DEFAULTS)

    _overrides=_DEFAULTS.copy()
    try:
        rl_exec('from reportlab.local_rl_settings import *',_overrides)
        _DEFAULTS.update(_overrides)
    except ImportError:
        pass

    _overrides=_DEFAULTS.copy()
    try:
        rl_exec('from reportlab_settings import *',_overrides)
        _DEFAULTS.update(_overrides)
    except ImportError:
        _overrides=_DEFAULTS.copy()
        try:
            with open(os.path.expanduser(os.path.join('~','.reportlab_settings')),'rb') as f:
                rl_exec(f.read(),_overrides)
            _DEFAULTS.update(_overrides)
        except:
            pass
    return _DEFAULTS
def _defaults_init():
    '''
    create & return defaults for all reportlab settings from
    reportlab.rl_settings.py
    reportlab.local_rl_settings.py
    reportlab_settings.py or ~/.reportlab_settings

    latter values override earlier
    '''
    from reportlab.lib.utils import rl_exec
    import os

    _DEFAULTS={}
    rl_exec('from reportlab.rl_settings import *',_DEFAULTS)

    _overrides=_DEFAULTS.copy()
    try:
        rl_exec('from reportlab.local_rl_settings import *',_overrides)
        _DEFAULTS.update(_overrides)
    except ImportError:
        pass

    _overrides=_DEFAULTS.copy()
    try:
        rl_exec('from reportlab_settings import *',_overrides)
        _DEFAULTS.update(_overrides)
    except ImportError:
        _overrides=_DEFAULTS.copy()
        try:
            with open(os.path.expanduser(os.path.join('~','.reportlab_settings')),'rb') as f:
                rl_exec(f.read(),_overrides)
            _DEFAULTS.update(_overrides)
        except:
            pass
    return _DEFAULTS
Exemple #11
0
	def reportlabDLLs(self,postcludes=[]):
		from rlextra.utils.superglob import FileSet, SuperFileSet
		F = []
		for modname in '''_renderPM _rl_accel sgmlop pyRXPU pyRXP pyHnj'''.split():
			NS = {}
			rl_exec("import %s as mod" % modname,NS)
			mod = NS['mod']
			del NS
			fn = mod.__file__
			fs = FileSet(path_dirname(fn))
			fs.include('./'+path_basename(fn))
			F.append(fs)
		sfs = SuperFileSet(F)
		for d in postcludes: getattr(sfs,d[0])(d[1])
		return sfs
Exemple #12
0
def getModuleObjects(modules):
    objects = {}
    lookup = {}
    for mName in modules:
        try:
            NS = {}
            rl_exec("import %s as module" % mName,NS)
        except ImportError:
            continue
        else:
            module = NS['module']
        if module in lookup: continue

        lookup[module] = 1
        objects.setdefault('module',[]).append((mName, module))
        modBn = os.path.splitext(module.__file__)[0]
        getObjects(objects,lookup,mName,modBn,module)
    return objects
def getModuleObjects(modules):
    objects = {}
    lookup = {}
    for mName in modules:
        try:
            NS = {}
            rl_exec("import %s as module" % mName, NS)
        except ImportError:
            continue
        else:
            module = NS['module']
        if module in lookup: continue

        lookup[module] = 1
        objects.setdefault('module', []).append((mName, module))
        modBn = os.path.splitext(module.__file__)[0]
        getObjects(objects, lookup, mName, modBn, module)
    return objects
Exemple #14
0
def _BCW(doc,codeName,attrMap,mod,value,**kwds):
    """factory for Barcode Widgets"""
    _pre_init = kwds.pop('_pre_init','')
    _methods = kwds.pop('_methods','')
    name = 'Barcode'+codeName
    ns = vars().copy()
    code = 'from %s import %s' % (mod,codeName)
    rl_exec(code,ns)
    ns['_BarcodeWidget'] = _BarcodeWidget
    code = '''class %(name)s(_BarcodeWidget,%(codeName)s):
\t_BCC = %(codeName)s
\tcodeName = %(codeName)r
\tdef __init__(self,**kw):%(_pre_init)s
\t\t_BarcodeWidget.__init__(self,%(value)r,**kw)%(_methods)s''' % ns
    rl_exec(code,ns)
    Klass = ns[name]
    if attrMap: Klass._attrMap = attrMap
    if doc: Klass.__doc__ = doc
    for k, v in kwds.items():
        setattr(Klass,k,v)
    return Klass
Exemple #15
0
def _BCW(doc, codeName, attrMap, mod, value, **kwds):
    """factory for Barcode Widgets"""
    _pre_init = kwds.pop('_pre_init', '')
    _methods = kwds.pop('_methods', '')
    name = 'Barcode' + codeName
    ns = vars().copy()
    code = 'from %s import %s' % (mod, codeName)
    rl_exec(code, ns)
    ns['_BarcodeWidget'] = _BarcodeWidget
    code = '''class %(name)s(_BarcodeWidget,%(codeName)s):
\t_BCC = %(codeName)s
\tcodeName = %(codeName)r
\tdef __init__(self,**kw):%(_pre_init)s
\t\t_BarcodeWidget.__init__(self,%(value)r,**kw)%(_methods)s''' % ns
    rl_exec(code, ns)
    Klass = ns[name]
    if attrMap: Klass._attrMap = attrMap
    if doc: Klass.__doc__ = doc
    for k, v in kwds.items():
        setattr(Klass, k, v)
    return Klass
Exemple #16
0
def _defaults_init():
    """
    create & return defaults for all reportlab settings from
    reportlab.rl_settings.py
    reportlab.local_rl_settings.py
    reportlab_settings.py or ~/.reportlab_settings

    latter values override earlier
    """
    from reportlab.lib.utils import rl_exec
    import os

    _DEFAULTS = {}
    rl_exec("from reportlab.rl_settings import *", _DEFAULTS)

    _overrides = _DEFAULTS.copy()
    try:
        rl_exec("from reportlab.local_rl_settings import *", _overrides)
        _DEFAULTS.update(_overrides)
    except ImportError:
        pass

    _overrides = _DEFAULTS.copy()
    try:
        rl_exec("from reportlab_settings import *", _overrides)
        _DEFAULTS.update(_overrides)
    except ImportError:
        _overrides = _DEFAULTS.copy()
        try:
            try:
                fn = os.path.expanduser(
                    os.path.join("~", ".reportlab_settings")
                )  # appengine fails with KeyError/ImportError (dev/live)
            except (KeyError, ImportError):
                fn = None
            if fn:
                with open(fn, "rb") as f:
                    rl_exec(f.read(), _overrides)
                _DEFAULTS.update(_overrides)
        except:
            pass
    return _DEFAULTS
Exemple #17
0
'''module that aggregates config information'''
__all__=('_reset','register_reset')
from reportlab.lib.utils import rl_exec
_overrides = {}
try:
    rl_exec('from reportlab.local_rl_settings import *',_overrides)
except ImportError:
    pass
try:
    rl_exec('from local_rl_settings import *',_overrides)
except ImportError:
    pass
_DEFAULTS={}
rl_exec('from reportlab.rl_settings import *',_DEFAULTS)
_DEFAULTS.update(_overrides)
del _overrides,rl_exec

_SAVED = {}
sys_version=None

#this is used to set the options from
def _setOpt(name, value, conv=None):
    '''set a module level value from environ/default'''
    from os import environ
    ename = 'RL_'+name
    if ename in environ:
        value = environ[ename]
    if conv: value = conv(value)
    globals()[name] = value

def _startUp():
Exemple #18
0
def preProcess(tree, nameSpace, caller=None):
    """Expands the parsed tree in the namespace and return new one.
    Returns a single tag-tuple in most cases, but a list of them
    if processing a loop node.

    """
    from reportPackages.rlextra.radxml import xmlutils
    #expand this into a class with methods for each tag it handles.
    #then I can put logic tags in one and data access in another.
    tagName, attrs, children, extraStuff = tree

    #any attribute as $name becomes th value of name
    #tags might be nested in a loop, and if so then
    #each dictionary must be a fresh copy rather than
    # a pointer to the same dict
    
    newAttrs = attrs.copy() if attrs is not None else {}
    for key, value in list(newAttrs.items()):
        if isinstance(value,str) and value[0:1] == '$':
            newValue = eval(value[1:], nameSpace)
            newAttrs[key] = newValue
    attrs = newAttrs

    if tagName in TAG_LOOP:
        innerTxt = attrs[TAG_LOOP_INNER]
        outer = eval(attrs[TAG_LOOP_OUTER], nameSpace)
        dataSet = []
        for row in outer:
            nameSpace['__loop_inner__'] = row
            rl_exec((innerTxt + " = __loop_inner__\n"), nameSpace)
            #at this point we're making lots of child nodes.
            # the attribute dictionary of each shold be a copy, not
            # a reference
            newChildren = processChildren(children, nameSpace)
            if newChildren is not None:
                dataSet.extend(newChildren)
        return dataSet

    elif tagName in TAG_ASSIGN:
        name = attrs[TAG_ASSIGN_NAME]
        valueStr = attrs[TAG_ASSIGN_VALUE]
        try:
            value = eval(valueStr, nameSpace)
        except SyntaxError:  #must be a string
            value = valueStr
        nameSpace[name] = value
        return None

    elif tagName in TAG_SCRIPT:
        code = children[0]
        if not code.endswith('\n'): code += '\n'
        try:
            rl_exec(code, nameSpace)
        except SyntaxError:
            raise SyntaxError("Error with following script in xpreppy:\n\n%s" % code)
        return None

    elif tagName in TAG_EXPR:
        exprText = children[0]
        assert isinstance(exprText,strTypes), "expr can only contain strings"

        #attributes may affect escaping
        escape = attrs.get(u'escape', None)
        encoding = attrs.get(u'encoding',u'utf8')

        exprValue = eval(exprText, nameSpace)
        if isBytes(exprValue):
            exprValue = exprValue.decode(encoding)
        elif isUnicode(exprValue):
            pass
        else:
            exprValue = asUnicodeEx(exprValue)

        if escape in (u'CDATA',u'CDATAESCAPE'):
            exprValue = u'<![CDATA[%s]]>' % exprValue
            if escape==u'CDATA': return [exprValue]
        elif escape == u'off':
            return [asUnicodeEx(exprValue)]
        elif escape == u'unescape':
            return [xmlutils.unescape(exprValue, ENTITY_SUBSTITUTIONS_DRAWSTRING_DICT)]
        return [xmlEscape(exprValue)]

    elif tagName in TAG_IF:
        condText = attrs[u'cond']
        yesOrNo = eval(condText, nameSpace)
        if yesOrNo:
            return processChildren(children, nameSpace)
    
    elif tagName in TAG_SWITCH:
        #two modes, with and without top level variable
        exprText = attrs.get(u'expr',u'')

        if exprText:
            expr = eval(exprText, nameSpace)

        selected = None
        for child in children:
            if isinstance(child,tuple):
                (childTagName, childAttrs, grandChildren, stuff) = child
                if childTagName in TAG_CASE:
                    condition = childAttrs[u'condition']
                    if exprText:
                        #check if it equals the value
                        try:
                            value = eval(condition, nameSpace)
                        except NameError:
                            value = condition # assume a string
                        if (expr == value):
                            selected = processChildren(grandChildren, nameSpace)
                            break
                    else:
                        #they gave us a full condition, evaluate it
                        yes = eval(condition, nameSpace)
                        if yes:
                            selected = processChildren(grandChildren, nameSpace)
                            break
                elif childTagName in TAG_DEFAULT:
                    selected = processChildren(grandChildren, nameSpace)
                    break
                else:
                    raise ValueError('%s tag may only contain these tags: ' % (TAG_SWITCH, ', '.join(TAG_CASE+TAG_DEFAULT)))

                    
        return selected

    elif tagName in TAG_ACQUIRE:
        #all children will be data fetchers
        xacquire.acquireData(children, nameSpace)
        return None

    elif tagName in TAG_DOCLET:
        #pull out args needed to initialize
        dirName = attrs.get(u"baseDir", None)
        moduleName = attrs[u"module"]
        className = attrs[u"class"]
        dataStr = attrs.get(u"data", None)

        #load module, import and create it
        if caller == 'rml':
            from reportPackages.rlextra.rml2pdf.rml2pdf import _rml2pdf_locations
            locations = _rml2pdf_locations(dirName)
        else:
            locations = dirName
        m = recursiveImport(moduleName, locations)
        klass = getattr(m, className)
        docletObj = klass()

        #give it the data model
        if dataStr:
            dataObj = eval(dataStr, nameSpace)
        else:
            dataObj = nameSpace

        docletObj.setData(dataObj)
            

        #hide it in the tree so RML can see the object
        attrs[u'__doclet__'] = docletObj

        #return the tag otherwise unmodified        
        return (tagName, attrs, children, extraStuff)
    
    else:
        newChildren = processChildren(children, nameSpace)
        return (tagName, attrs, newChildren, extraStuff)
Exemple #19
0
def preProcess(tree, nameSpace, caller=None):
    """Expands the parsed tree in the namespace and return new one.
    Returns a single tag-tuple in most cases, but a list of them
    if processing a loop node.

    """
    from rlextra.radxml import xmlutils
    #expand this into a class with methods for each tag it handles.
    #then I can put logic tags in one and data access in another.
    tagName, attrs, children, extraStuff = tree

    #any attribute as $name becomes th value of name
    #tags might be nested in a loop, and if so then
    #each dictionary must be a fresh copy rather than
    # a pointer to the same dict
    
    newAttrs = attrs.copy() if attrs is not None else {}
    for key, value in list(newAttrs.items()):
        if isinstance(value,str) and value[0:1] == '$':
            newValue = eval(value[1:], nameSpace)
            newAttrs[key] = newValue
    attrs = newAttrs

    if tagName in TAG_LOOP:
        innerTxt = attrs[TAG_LOOP_INNER]
        outer = eval(attrs[TAG_LOOP_OUTER], nameSpace)
        dataSet = []
        for row in outer:
            nameSpace['__loop_inner__'] = row
            rl_exec((innerTxt + " = __loop_inner__\n"), nameSpace)
            #at this point we're making lots of child nodes.
            # the attribute dictionary of each shold be a copy, not
            # a reference
            newChildren = processChildren(children, nameSpace)
            if newChildren is not None:
                dataSet.extend(newChildren)
        return dataSet

    elif tagName in TAG_ASSIGN:
        name = attrs[TAG_ASSIGN_NAME]
        valueStr = attrs[TAG_ASSIGN_VALUE]
        try:
            value = eval(valueStr)
        except SyntaxError:  #must be a string
            value = valueStr
        nameSpace[name] = value
        return None

    elif tagName in TAG_SCRIPT:
        code = children[0]
        if not code.endswith('\n'): code += '\n'
        try:
            rl_exec(code, nameSpace)
        except SyntaxError:
            raise SyntaxError("Error with following script in xpreppy:\n\n%s" % code)
        return None

    elif tagName in TAG_EXPR:
        exprText = children[0]
        assert isinstance(exprText,strTypes), "expr can only contain strings"

        #attributes may affect escaping
        escape = attrs.get(u'escape', None)
        encoding = attrs.get(u'encoding',u'utf8')

        exprValue = eval(exprText, nameSpace)
        if isBytes(exprValue):
            exprValue = exprValue.decode(encoding)
        elif isUnicode(exprValue):
            pass
        else:
            exprValue = asUnicodeEx(exprValue)

        if escape in (u'CDATA',u'CDATAESCAPE'):
            exprValue = u'<![CDATA[%s]]>' % exprValue
            if escape==u'CDATA': return [exprValue]
        elif escape == u'off':
            return [asUnicodeEx(exprValue)]
        elif escape == u'unescape':
            return [xmlutils.unescape(exprValue, ENTITY_SUBSTITUTIONS_DRAWSTRING_DICT)]
        return [xmlEscape(exprValue)]

    elif tagName in TAG_IF:
        condText = attrs[u'cond']
        yesOrNo = eval(condText, nameSpace)
        if yesOrNo:
            return processChildren(children, nameSpace)
    
    elif tagName in TAG_SWITCH:
        #two modes, with and without top level variable
        exprText = attrs.get(u'expr',u'')

        if exprText:
            expr = eval(exprText, nameSpace)

        selected = None
        for child in children:
            if isinstance(child,tuple):
                (childTagName, childAttrs, grandChildren, stuff) = child
                if childTagName in TAG_CASE:
                    condition = childAttrs[u'condition']
                    if exprText:
                        #check if it equals the value
                        try:
                            value = eval(condition, nameSpace)
                        except NameError:
                            value = condition # assume a string
                        if (expr == value):
                            selected = processChildren(grandChildren, nameSpace)
                            break
                    else:
                        #they gave us a full condition, evaluate it
                        yes = eval(condition, nameSpace)
                        if yes:
                            selected = processChildren(grandChildren, nameSpace)
                            break
                elif childTagName in TAG_DEFAULT:
                    selected = processChildren(grandChildren, nameSpace)
                    break
                else:
                    raise ValueError('%s tag may only contain these tags: ' % (TAG_SWITCH, ', '.join(TAG_CASE+TAG_DEFAULT)))

                    
        return selected

    elif tagName in TAG_ACQUIRE:
        #all children will be data fetchers
        xacquire.acquireData(children, nameSpace)
        return None

    elif tagName in TAG_DOCLET:
        #pull out args needed to initialize
        dirName = attrs.get(u"baseDir", None)
        moduleName = attrs[u"module"]
        className = attrs[u"class"]
        dataStr = attrs.get(u"data", None)

        #load module, import and create it
        if caller == 'rml':
            from rlextra.rml2pdf.rml2pdf import _rml2pdf_locations
            locations = _rml2pdf_locations(dirName)
        else:
            locations = dirName
        m = recursiveImport(moduleName, locations)
        klass = getattr(m, className)
        docletObj = klass()

        #give it the data model
        if dataStr:
            dataObj = eval(dataStr, nameSpace)
        else:
            dataObj = nameSpace

        docletObj.setData(dataObj)
            

        #hide it in the tree so RML can see the object
        attrs[u'__doclet__'] = docletObj

        #return the tag otherwise unmodified        
        return (tagName, attrs, children, extraStuff)
    
    else:
        newChildren = processChildren(children, nameSpace)
        return (tagName, attrs, newChildren, extraStuff)