Skip to content

Commit

Permalink
Merge pull request #192 from MasoniteFramework/provider-patch
Browse files Browse the repository at this point in the history
wsgi Provider patch
  • Loading branch information
josephmancuso committed Jun 25, 2018
2 parents 5118059 + 6742047 commit 9644ddc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions masonite/commands/ServeCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ServeCommand(Command):
"""

def handle(self):
self._check_patch()
if self.option('reload'):
self._run_with_reloader(extra_files=[".env"])

Expand All @@ -32,6 +33,23 @@ def _run_application(self):
application,
host=self.option('host'),
port=self.option('port'))

def _check_patch(self):
patched = False

with open('wsgi.py', 'r') as file:
# read a list of lines into data
data = file.readlines()

# change the line that starts with KEY=
for line_number, line in enumerate(data):
if line.startswith("for provider in container.make('Providers'):"):
patched = True
break

if not patched:
print('\033[93mWARNING: {}\033[0m'.format(
"Your application does not have a 2.0 patch! You can read more about this patch here: https://dev.to/josephmancuso/masonite-framework-20-patch-3op2"))

def _run_with_reloader(self, extra_files=None, interval=1):
"""Run the given function in an independent python interpreter."""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'masonite.contracts',
'masonite.helpers',
],
version='2.0.6',
version='2.0.7',
install_requires=[
'validator.py==1.2.5',
'cryptography==2.2.2',
Expand Down

0 comments on commit 9644ddc

Please sign in to comment.