Package web2py :: Package gluon :: Module shell
[hide private]
[frames] | no frames]

Module shell

source code

This file is part of web2py Web Framework (Copyrighted, 2007-2010). Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>, limodou <limodou@gmail.com> and srackham <srackham@gmail.com>. License: GPL v2

Functions [hide private]
 
exec_environment(pyfile='', request=<Storage {'function': None, 'wsgi': <Storage {}>, 'extension':..., response=<Storage {'status': 200, 'body': <cStringIO.StringO object at ..., session=<Storage {}>)
..
source code
 
env(a, import_models=False, c=None, f=None, dir='')
Return web2py execution environment for application (a), controller (c), function (f).
source code
 
exec_pythonrc() source code
 
run(appname, plain=False, import_models=False, startfile=None)
Start interactive shell or run Python script (startfile) in web2py controller environment.
source code
 
parse_path_info(path_info)
Parse path info formatted like a/c/f where c and f are optional and a leading / accepted.
source code
 
die(msg) source code
 
test(testpath, import_models=True, verbose=False)
Run doctests in web2py environment.
source code
 
get_usage() source code
 
execute_from_command_line(argv=None) source code
Variables [hide private]
  TEST_CODE = '\ndef _TEST():\n import doctest, sys, cStringI...
  cfs = {}
  cfs_lock = thread.allocate_lock()
  is_gae = None
  regex_expose = re.compile(r'(?m)^def\s+(?P<name>(?:[a-zA-Z0-9]...
  settings = <Storage {}>
Function Details [hide private]

exec_environment(pyfile='', request=<Storage {'function': None, 'wsgi': <Storage {}>, 'extension':..., response=<Storage {'status': 200, 'body': <cStringIO.StringO object at ..., session=<Storage {}>)

source code 

.. function:: gluon.shell.exec_environment([pyfile=''[, request=Request()
    [, response=Response[, sessions=Session()]]]])

    Environment builder and module loader.


    Builds a web2py environment and optionally executes a Python
    file into the environment.
    A Storage dictionary containing the resulting environment is returned.
    The working directory must be web2py root -- this is the web2py default.

env(a, import_models=False, c=None, f=None, dir='')

source code 

Return web2py execution environment for application (a), controller (c), function (f). If import_models is True the exec all application models into the environment.

run(appname, plain=False, import_models=False, startfile=None)

source code 

Start interactive shell or run Python script (startfile) in web2py controller environment. appname is formatted like:

a web2py application name a/c exec the controller c into the application environment

parse_path_info(path_info)

source code 

Parse path info formatted like a/c/f where c and f are optional and a leading / accepted. Return tuple (a, c, f). If invalid path_info a is set to None. If c or f are omitted they are set to None.

test(testpath, import_models=True, verbose=False)

source code 

Run doctests in web2py environment. testpath is formatted like:

a tests all controllers in application a a/c tests controller c in application a a/c/f test function f in controller c, application a

Where a, c and f are application, controller and function names respectively. If the testpath is a file name the file is tested. If a controller is specified models are executed by default.


Variables Details [hide private]

TEST_CODE

Value:
'''
def _TEST():
    import doctest, sys, cStringIO, types, cgi, gluon.fileutils
    if not gluon.fileutils.check_credentials(request):
        raise HTTP(400, web2py_error=\'invalid credentials\')
    stdout = sys.stdout
    html = \'<h2>Testing controller "%s.py" ... done.</h2><br/>\\n\' \\
\
...

regex_expose

Value:
re.compile(r'(?m)^def\s+(?P<name>(?:[a-zA-Z0-9]\w*)|(?:_[a-zA-Z0-9]\w*\
))\(\)\s*:')