Ñò ô†³Kc@s.dZd„Zd„Zd„Zd„ZdS(s¨ 'imports' a string -- converts a string to a Python object, importing any necessary modules and evaluating the expression. Everything before the : in an import expression is the module path; everything after is an expression to be evaluated in the namespace of that module. Alternately, if no : is present, then import the modules and get the attributes as necessary. Arbitrary expressions are not allowed in that case. cCsRd|jo t|ƒS|iddƒ\}}t|ƒ}t||iƒ}|S(s* Import a module, or import an object from a module. A module name like ``foo.bar:baz()`` can be used, where ``foo.bar`` is the module, and ``baz()`` is an expression evaluated in the context of that module. Note this is not safe on arbitrary strings because of the eval. t:i(t simple_importtsplitt import_moduletevalt__dict__(tst module_nametexprtmoduletobj((s</usr/lib/python2.6/site-packages/paste/util/import_string.pyt eval_imports   cCs|idƒ}t|dƒ}|d}|d}d}xW|oO|d|d7}yt|ƒ}|d}Wq<tj o}|}Pq<Xq<W|}x`|oXyt||dƒ}Wn0tj o$td|d||fƒ‚nX|d}qœW|S(s Import a module, or import an object from a module. A name like ``foo.bar.baz`` can be a module ``foo.bar.baz`` or a module ``foo.bar`` with an object ``baz`` in it, or a module ``foo`` with an object ``bar`` with an attribute ``baz``. t.iisECannot find %s in module %r (stopped importing modules with error %s)N(RRtNonet ImportErrortgetattrtAttributeError(RtpartsR tnametlast_import_errorteR ((s</usr/lib/python2.6/site-packages/paste/util/import_string.pyR s0    cCsCt|ƒ}|idƒ}x!|dD]}t||ƒ}q&W|S(s Import a module. R i(t __import__RR(RtmodRtpart((s</usr/lib/python2.6/site-packages/paste/util/import_string.pyR?s   cCsÆyt|ƒSWn±tj o¥}t|ddƒp‚n|id}|idƒp‚n|tdƒ}|idƒ}x9tt|ƒƒD]%}|di ||ƒjodSq‘W‚nXdS(sæ Imports a module, but catches import errors. Only catches errors when that module doesn't exist; if that module itself has an import error it will still get raised. Returns None if the module doesn't exist. targsisNo module named R N( RRRR Rt startswithtlenRtrangetjoin(RRtdescRti((s</usr/lib/python2.6/site-packages/paste/util/import_string.pyttry_import_moduleIs  N(t__doc__R RRR(((s</usr/lib/python2.6/site-packages/paste/util/import_string.pyts