
import os

from flask import Blueprint, current_app, render_template
from flaskrst.parsers import rstDocument

static_pages = Blueprint('static_pages', __name__, \
                         template_folder='templates')

@static_pages.route('/', defaults={'file_path': 'index'})
@static_pages.route('/<path:file_path>')
def show(file_path):
    if file_path.endswith('/'):
        file_path += "index"
    rst_file = os.path.join(current_app.config['SOURCE'], file_path + '.rst')
    rst = rstDocument(rst_file)
    return render_template("static_page.html", page=rst)
    
def setup(app, cfg):
    app.register_blueprint(static_pages)

from flask import Blueprint, current_app, render_template, safe_join
from flaskrst.parsers import rstDocument

staticpages = Blueprint('staticpages', __name__, template_folder='templates')

@staticpages.route('/', defaults={'file_path': 'index'})
@staticpages.route('/<path:file_path>')
def page(file_path):
    if file_path.endswith('/'):
        file_path += "index"
    rst_file = safe_join(current_app.config['SOURCE'], file_path + '.rst')
    rst = rstDocument(rst_file)
    return render_template("static_page.html", page=rst)
    
def setup(app, cfg):
    app.register_blueprint(staticpages)
Rename blueprint static_pages to staticpages and rename staticpages.show to staticpages.page
Rename blueprint static_pages to staticpages and rename staticpages.show to staticpages.page

  
- import os
- 
- from flask import Blueprint, current_app, render_template
+ from flask import Blueprint, current_app, render_template, safe_join
  from flaskrst.parsers import rstDocument
  
- static_pages = Blueprint('static_pages', __name__, \
+ staticpages = Blueprint('staticpages', __name__, template_folder='templates')
-                          template_folder='templates')
  
- @static_pages.route('/', defaults={'file_path': 'index'})
+ @staticpages.route('/', defaults={'file_path': 'index'})
- @static_pages.route('/<path:file_path>')
+ @staticpages.route('/<path:file_path>')
- def show(file_path):
+ def page(file_path):
      if file_path.endswith('/'):
          file_path += "index"
-     rst_file = os.path.join(current_app.config['SOURCE'], file_path + '.rst')
+     rst_file = safe_join(current_app.config['SOURCE'], file_path + '.rst')
      rst = rstDocument(rst_file)
      return render_template("static_page.html", page=rst)
      
  def setup(app, cfg):
-     app.register_blueprint(static_pages)
+     app.register_blueprint(staticpages)
Rename blueprint static_pages to staticpages and rename staticpages.show to staticpages.page
## Code Before:

import os

from flask import Blueprint, current_app, render_template
from flaskrst.parsers import rstDocument

static_pages = Blueprint('static_pages', __name__, \
                         template_folder='templates')

@static_pages.route('/', defaults={'file_path': 'index'})
@static_pages.route('/<path:file_path>')
def show(file_path):
    if file_path.endswith('/'):
        file_path += "index"
    rst_file = os.path.join(current_app.config['SOURCE'], file_path + '.rst')
    rst = rstDocument(rst_file)
    return render_template("static_page.html", page=rst)
    
def setup(app, cfg):
    app.register_blueprint(static_pages)
## Instruction:
Rename blueprint static_pages to staticpages and rename staticpages.show to staticpages.page
## Code After:

from flask import Blueprint, current_app, render_template, safe_join
from flaskrst.parsers import rstDocument

staticpages = Blueprint('staticpages', __name__, template_folder='templates')

@staticpages.route('/', defaults={'file_path': 'index'})
@staticpages.route('/<path:file_path>')
def page(file_path):
    if file_path.endswith('/'):
        file_path += "index"
    rst_file = safe_join(current_app.config['SOURCE'], file_path + '.rst')
    rst = rstDocument(rst_file)
    return render_template("static_page.html", page=rst)
    
def setup(app, cfg):
    app.register_blueprint(staticpages)