Browse Source

Merge branch 'master' of github.com:mitsuhiko/flask

pull/327/head
Armin Ronacher 13 years ago
parent
commit
81b4271fa6
  1. 8
      flask/app.py
  2. 2
      flask/views.py
  3. 17
      setup.py

8
flask/app.py

@ -657,7 +657,7 @@ class Flask(_PackageBoundObject):
# existing views. # existing views.
context.update(orig_ctx) context.update(orig_ctx)
def run(self, host='127.0.0.1', port=5000, **options): def run(self, host='127.0.0.1', port=5000, debug=None, **options):
"""Runs the application on a local development server. If the """Runs the application on a local development server. If the
:attr:`debug` flag is set the server will automatically reload :attr:`debug` flag is set the server will automatically reload
for code changes and show a debugger in case an exception happened. for code changes and show a debugger in case an exception happened.
@ -680,14 +680,16 @@ class Flask(_PackageBoundObject):
:param host: the hostname to listen on. set this to ``'0.0.0.0'`` :param host: the hostname to listen on. set this to ``'0.0.0.0'``
to have the server available externally as well. to have the server available externally as well.
:param port: the port of the webserver :param port: the port of the webserver
:param debug: if given, enable or disable debug mode.
See :attr:`debug`.
:param options: the options to be forwarded to the underlying :param options: the options to be forwarded to the underlying
Werkzeug server. See Werkzeug server. See
:func:`werkzeug.serving.run_simple` for more :func:`werkzeug.serving.run_simple` for more
information. information.
""" """
from werkzeug.serving import run_simple from werkzeug.serving import run_simple
if 'debug' in options: if debug is not None:
self.debug = options.pop('debug') self.debug = bool(debug)
options.setdefault('use_reloader', self.debug) options.setdefault('use_reloader', self.debug)
options.setdefault('use_debugger', self.debug) options.setdefault('use_debugger', self.debug)
try: try:

2
flask/views.py

@ -64,7 +64,7 @@ class View(object):
def dispatch_request(self): def dispatch_request(self):
"""Subclasses have to override this method to implement the """Subclasses have to override this method to implement the
actual view functionc ode. This method is called with all actual view function code. This method is called with all
the arguments from the URL rule. the arguments from the URL rule.
""" """
raise NotImplementedError() raise NotImplementedError()

17
setup.py

@ -49,7 +49,7 @@ class run_audit(Command):
user_options = [] user_options = []
def initialize_options(self): def initialize_options(self):
all = None pass
def finalize_options(self): def finalize_options(self):
pass pass
@ -62,22 +62,19 @@ class run_audit(Command):
print "Audit requires PyFlakes installed in your system.""" print "Audit requires PyFlakes installed in your system."""
sys.exit(-1) sys.exit(-1)
dirs = ['flask', 'tests']
# Add example directories
for dir in ['flaskr', 'jqueryexample', 'minitwit']:
dirs.append(os.path.join('examples', dir))
# TODO: Add test subdirectories
warns = 0 warns = 0
# Define top-level directories
dirs = ('flask', 'examples', 'scripts')
for dir in dirs: for dir in dirs:
for filename in os.listdir(dir): for root, _, files in os.walk(dir):
if filename.endswith('.py') and filename != '__init__.py': for file in files:
warns += flakes.checkPath(os.path.join(dir, filename)) if file != '__init__.py' and file.endswith('.py') :
warns += flakes.checkPath(os.path.join(root, file))
if warns > 0: if warns > 0:
print ("Audit finished with total %d warnings." % warns) print ("Audit finished with total %d warnings." % warns)
else: else:
print ("No problems found in sourcecode.") print ("No problems found in sourcecode.")
setup( setup(
name='Flask', name='Flask',
version='0.8-dev', version='0.8-dev',

Loading…
Cancel
Save