def exec_environment(pyfile='', request=None, response=None, session=None):
 if (request is None):
  request = Request({})
 if (response is None):
  response = Response()
 if (session is None):
  session = Session()
 if (request.folder is None):
  mo = re.match('(|.*/)applications/(?P<appname>[^/]+)', pyfile)
  if mo:
   appname = mo.group('appname')
   request.folder = os.path.join('applications', appname)
  else:
   request.folder = ''
 env = build_environment(request, response, session, store_current=False)
 if pyfile:
  pycfile = (pyfile + 'c')
  if os.path.isfile(pycfile):
   exec read_pyc(pycfile) in env
  else:
   execfile(pyfile, env)
 return Storage(env)

def exec_environment ( pyfile = '' , request = None , response = None , session = None ) : if ( request is None ) : request = Request ( { } ) if ( response is None ) : response = Response ( ) if ( session is None ) : session = Session ( ) if ( request . folder is None ) : mo = re . match ( '(|.*/)applications/(?P<appname>[^/]+)' , pyfile ) if mo : appname = mo . group ( 'appname' ) request . folder = os . path . join ( 'applications' , appname ) else : request . folder = '' env = build_environment ( request , response , session , store_current = False ) if pyfile : pycfile = ( pyfile + 'c' ) if os . path . isfile ( pycfile ) : exec read_pyc ( pycfile ) in env else : execfile ( pyfile , env ) return Storage ( env )
environment builder and module loader .