ó
TRšNc           @   sF   d  d l  Z  d  d l m Z d  d l m Z d e f d     YZ d S(   i˙˙˙˙N(   t   NoArgsCommand(   t   make_optiont   Commandc        	   B   sE   e  Z e j e d  d d d d d d f Z d Z e Z d   Z RS(	   s   --plaint   actiont
   store_truet   destt   plaint   helps.   Tells Django to use plain Python, not IPython.sO   Runs a Python interactive interpreter. Tries to use IPython, if it's available.c         K   s]  d d l  m } |   } | j d t  } y> | r= t  n  d d  l } | j j d g   } | j   Wní t k
 rXd d  l	 } i  } y d d  l
 }	 Wn t k
 rŽ n3 Xd d  l }
 |	 j |
 j |  j  |	 j d  | sEt j j d  } | r6t j j |  r6y t |  Wq6t k
 r2q6Xn  d d  l } n  | j d |  n Xd  S(   Ni˙˙˙˙(   t
   get_modelsR   t   argvs   tab:completet   PYTHONSTARTUPt   local(   t   django.db.models.loadingR   t   gett   Falset   ImportErrort   IPythont   Shellt   IPShellt   mainloopt   codet   readlinet   rlcompletert   set_completert	   Completert   completet   parse_and_bindt   ost   environt   patht   isfilet   execfilet	   NameErrort   usert   interact(   t   selft   optionsR   t   loaded_modelst	   use_plainR   t   shellR   t   imported_objectsR   R   t   pythonrcR!   (    (    sR   /home/panlixing/Python_Projects/gaeseries/django/core/management/commands/shell.pyt   handle_noargs   s8    		(	   t   __name__t
   __module__R    t   option_listR   R   R   t   requires_model_validationR*   (    (    (    sR   /home/panlixing/Python_Projects/gaeseries/django/core/management/commands/shell.pyR      s   (   R   t   django.core.management.baseR    t   optparseR   R   (    (    (    sR   /home/panlixing/Python_Projects/gaeseries/django/core/management/commands/shell.pyt   <module>   s   