From 2fe6088f99e4c090149a11652c3a5aaa895eb4fa Mon Sep 17 00:00:00 2001 From: Joseph Mancuso Date: Sun, 14 Jan 2018 17:14:25 -0500 Subject: [PATCH 1/4] fixed exclude list not being a list --- masonite/routes.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/masonite/routes.py b/masonite/routes.py index 4c2e5ea2d..6d39dc89b 100644 --- a/masonite/routes.py +++ b/masonite/routes.py @@ -142,7 +142,7 @@ def __init__(self): self.method_type = 'POST' self.continueroute = True self.url = False - self.exclude_list = False + self.exclude_list = [] self.output = False self.model_obj = None diff --git a/setup.py b/setup.py index 4912dad89..d435cec16 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ 'masonite.extensions', 'masonite.facades', ], # this must be the same as the name above - version='0.2.6', + version='0.2.7.1', description='The core for the python framework', author='Joseph Mancuso', author_email='idmann509@gmail.com', From 842a5d39a062dccfd756f40fe0c252718395b276 Mon Sep 17 00:00:00 2001 From: Joseph Mancuso Date: Tue, 16 Jan 2018 10:42:10 -0500 Subject: [PATCH 2/4] added a way to send parameters to a named route --- masonite/request.py | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/masonite/request.py b/masonite/request.py index 9f3dc1c73..1516c49ad 100644 --- a/masonite/request.py +++ b/masonite/request.py @@ -89,9 +89,38 @@ def user(self): def redirect(self, route): ''' Redirect the user based on the route specified ''' self.redirect_url = route - return 'redirecting ...' + return self def redirectTo(self, route): ''' Redirect to a named route ''' self.redirect_route = route - return 'redirecting ...' + return self + + def compile_route_to_url(self): + ''' Compile the route url into a usable url + Converts /url/@id into /url/1. Used for redirection + ''' + + # Split the url into a list + split_url = self.redirect_url.split('/') + + # Start beginning of the new compiled url + compiled_url = '/' + + # Iterate over the list + for url in split_url: + + # if the url contains a parameter variable like @id:int + if '@' in url: + url = url.replace('@', '').replace(':int', '').replace(':string', '') + compiled_url += '/' + str(self.param(url)) + else: + compiled_url += url + + return compiled_url + + def send(self, params): + ''' With ''' + print('send url params') + self.set_params(params) + return self From dc48d82f3931302202228f3c12ef0e61e2f4d087 Mon Sep 17 00:00:00 2001 From: Joseph Mancuso Date: Tue, 16 Jan 2018 10:43:46 -0500 Subject: [PATCH 3/4] removed print statement --- masonite/request.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/masonite/request.py b/masonite/request.py index 1516c49ad..6b7376839 100644 --- a/masonite/request.py +++ b/masonite/request.py @@ -109,7 +109,7 @@ def compile_route_to_url(self): # Iterate over the list for url in split_url: - + # if the url contains a parameter variable like @id:int if '@' in url: url = url.replace('@', '').replace(':int', '').replace(':string', '') @@ -121,6 +121,5 @@ def compile_route_to_url(self): def send(self, params): ''' With ''' - print('send url params') self.set_params(params) return self From d94553116544857c7a6120b0f187ac3bed2df4bc Mon Sep 17 00:00:00 2001 From: Joseph Mancuso Date: Tue, 16 Jan 2018 10:52:44 -0500 Subject: [PATCH 4/4] added back to request --- masonite/request.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/masonite/request.py b/masonite/request.py index 6b7376839..420c4d156 100644 --- a/masonite/request.py +++ b/masonite/request.py @@ -96,6 +96,11 @@ def redirectTo(self, route): self.redirect_route = route return self + def back(self, input_parameter='back'): + ''' Go to a named route with the back parameter ''' + self.redirectTo(self.input(input_parameter)) + return self + def compile_route_to_url(self): ''' Compile the route url into a usable url Converts /url/@id into /url/1. Used for redirection