Example #1
0
  def create_app(self):
    app = Flask(__name__)
    app.config.update({
      'TESTING': True,
      'CSRF_ENABLED': False,
      'WTF_CSRF_ENABLED': False,
    })

    app.default_view = Registry()
    return app
Example #2
0
# 
from flask import render_template

def _default_view( templatename = None, error = None, redirect = None ):

    if error is not None:
        flash(error, 'error');
    
    if templatename is None:
        templatename = 'layout.html'
    if not redirect is None:
    	return redirect(url_for(redirect))
    
    return render_template( templatename, error = error )

base_app.default_view = _default_view

def default_view( *args, **kargs ):
	return base_app.default_view(*args, **kargs)

# ##############################################################################
# name: call_view
# synop: calls the view function for the end-point given with the args given

from flask import url_for, redirect
def call_view(endpoint, *args, **kargs):
    # have to do redirect because of namespace issues
    #    return base_app.view_functions[endpoint](*args,**kargs)
    return redirect(url_for(endpoint, *args, **kargs))