Exemplo n.º 1
0
 def handle(self, url, context, use_pdb, *args, **kwargs):
     if context:
         context_dict = eval(context)
     else:
         context_dict = {}
     context = Context(context_dict)
     if url is not None:
         setup_test_environment()
         client = Client()
         response = client.get(url)
         if not response.context:
             print 'Response for given URL contains no context (code %s).' % response.status_code
         else:
             if isinstance(response.context, Context):
                 context = response.context
             elif type(response.context) == list:
                 context = response.context[0]
             else:
                 try:
                     from django.test.utils import ContextList
                 except ImportError:
                     pass
                 else:
                     if isinstance(response.context, ContextList):
                         # TODO: probably should try to merge all contexts
                         context = response.context[0]
     if use_pdb:
         pdb_with_context(context)
     else:
         run_shell(context)
Exemplo n.º 2
0
 def handle(self, url, context, use_pdb, *args, **kwargs):
     if context:
         context_dict = eval(context)
     else:
         context_dict = {}
     context = Context(context_dict)
     if url is not None:
         setup_test_environment()
         client = Client()
         response = client.get(url)
         if not response.context:
             print 'Response for given URL contains no context (code %s).' % response.status_code
         else:
             if isinstance(response.context, Context):
                 context = response.context
             elif type(response.context) == list:
                 context = response.context[0]
             else:
                 try:
                     from django.test.utils import ContextList
                 except ImportError:
                     pass
                 else:
                     if isinstance(response.context, ContextList):
                         # TODO: probably should try to merge all contexts
                         context = response.context[0]
     if use_pdb:
         pdb_with_context(context)
     else:
         run_shell(context)
Exemplo n.º 3
0
 def render(self, context):
     if self.use_pdb:
         pdb_with_context(context)
     else:
         setup_readline_history()
         run_shell(context)
     return ''
 def handle(self, url, context, use_pdb, *args, **kwargs):
     if context:
         context_dict = eval(context)
     else:
         context_dict = {}
     context = Context(context_dict)
     if url is not None:
         setup_test_environment()
         client = Client()
         response = client.get(url)
         if not response.context:
             print 'Response for given URL contains no context (code %s).' % response.status_code
         else:
             if isinstance(response.context, Context):
                 context = response.context
             elif isinstance(response.context, ContextList):
                 # TODO: probably should try to merge all contexts
                 context = response.context[0]
     if use_pdb:
         pdb_with_context(context)
     else:
         setup_readline_history()
         run_shell(context)
Exemplo n.º 5
0
 def render(self, context):
     if self.use_pdb:
         pdb_with_context(context)
     else:
         run_shell(context)
     return ""
Exemplo n.º 6
0
 def render(self, context):
     if self.use_pdb:
         pdb_with_context(context)
     else:
         run_shell(context)
     return ''