Skip to content
Myr

shorten cli factory name

Before adoption: this commit came in with the history the project adopted, so no landing records it.

[ci skip]

authored by David Lord · committed by David Lord · parent ae41df9 · Browse files · 1 file+11 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−13 removed

  • other:+11 added−13 removed

1 file+11 added−13 removed

modified:flask/cli.py+11 added-13 removed
59 unmodified lines
60 app_factory = getattr(module, attr_name, None)6162 if callable(app_factory):63 try:64 app = check_factory_for_script_info_and_call(app_factory,65 script_info)64 app = call_factory(app_factory, script_info)65 if isinstance(app, Flask):66 return app67 except TypeError:68 raise NoAppException(
9 unmodified lines
78 'middleware.'.format(module=module.__name__)79 )808183def check_factory_for_script_info_and_call(func, script_info):84 """Given a function this checks if the function has an argument named 85 script_info or just a single argument and calls the function with 86 script_info if so. Otherwise calls the function without any arguments and 87 returns the result."""82def call_factory(func, script_info):83 """Checks if the given app factory function has an argument named 84 ``script_info`` or just a single argument and calls the function passing 85 ``script_info`` if so. Otherwise, calls the function without any arguments86 and returns the result.87 """88 arguments = getargspec(func).args89 if 'script_info' in arguments:90 result = func(script_info=script_info)90 return func(script_info=script_info)91 elif len(arguments) == 1:92 result = func(script_info)93 else:94 result = func()95 return result92 return func(script_info)93 return func()949596def prepare_exec_for_file(filename):97 """Given a filename this will try to calculate the python path, add it
174 unmodified lines
272 __traceback_hide__ = True273 if self._loaded_app is not None:274 return self._loaded_app275 if self.create_app is not None:278 rv = check_factory_for_script_info_and_call(self.create_app, self)276 rv = call_factory(self.create_app, self)277 else:278 if not self.app_import_path:279 raise NoAppException(280 'Could not locate Flask application. You did not provide '
341 unmodified lines