restricted Module

This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>

Restricted environment to execute application’s code

exception gluon.restricted.RestrictedError(layer='', code='', output='', environment=None)[source]

Bases: exceptions.Exception

Class used to wrap an exception that occurs in the restricted environment below. The traceback is used to log the exception and generate a ticket.

load(request, app, ticket_id)[source]

Loads a logged exception.

log(request)[source]

Logs the exception.

gluon.restricted.restricted(code, environment=None, layer='Unknown')[source]

Runs code in environment and returns the output. If an exception occurs in code it raises a RestrictedError containing the traceback. Layer is passed to RestrictedError to identify where the error occurred.

class gluon.restricted.TicketStorage(db=None, tablename='web2py_ticket')[source]

Bases: gluon.storage.Storage

Defines the ticket object and the default values of its members (None)

load(request, app, ticket_id)[source]
store(request, ticket_id, ticket_data)[source]

Stores the ticket. It will figure out if this must be on disk or in db

gluon.restricted.compile2(code, layer)[source]

The +'\n' is necessary else compile fails when code ends in a comment.