• File: import_string.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python27/lib/python2.7/site-packages/paste/util/import_string.pyc
  • Date Modified: 08/01/2016 7:39 PM
  • File size: 3.24 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

bNc@s.dZdZdZdZdZdS(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.
cCsPd|krt|S|jdd\}}t|}t||j}|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__(tstmodule_nametexprtmoduletobj((sI/opt/alt/python27/lib/python2.7/site-packages/paste/util/import_string.pyteval_imports	
cCs|jd}t|d}|d}|d}d}xS|r|d|d7}yt|}|d}Wq<tk
r}|}Pq<Xq<W|}x\|ryt||d}Wn.tk
rtd|d||fnX|d}qW|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(RRtNonetImportErrortgetattrtAttributeError(RtpartsR	tnametlast_import_errorteR
((sI/opt/alt/python27/lib/python2.7/site-packages/paste/util/import_string.pyR s,

			
cCsCt|}|jd}x!|dD]}t||}q&W|S(s
    Import a module.
    Ri(t
__import__RR(RtmodRtpart((sI/opt/alt/python27/lib/python2.7/site-packages/paste/util/import_string.pyR?s
cCsyt|SWntk
r}t|dds8n|jd}|jdsZn|td}|jd}x7tt|D]#}|dj	||krdSqWnXdS(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((sI/opt/alt/python27/lib/python2.7/site-packages/paste/util/import_string.pyttry_import_moduleIs
N(t__doc__RRRR(((sI/opt/alt/python27/lib/python2.7/site-packages/paste/util/import_string.pyt<module>s