Skip to content

Commit

Permalink
only print Running init() if user specifies an init
Browse files Browse the repository at this point in the history
  • Loading branch information
erik-dunteman committed Jul 24, 2023
1 parent 67ac6d3 commit b164bf3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion potassium/potassium.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Potassium():
def __init__(self, name):
self.name = name

# default init function, if the user doesn't specify one
def empty_init():
return {}

Expand All @@ -53,6 +54,7 @@ def init(self, func):
"""

def wrapper():
print(colored("Running init()", 'yellow'))
self._context = func()
if not isinstance(self._context, dict):
raise Exception("Potassium init() must return a dictionary")
Expand Down Expand Up @@ -204,7 +206,6 @@ def handle(path):
# serve runs the http server
def serve(self, host="0.0.0.0", port=8000):
print(colored("------\nStarting Potassium Server 🍌", 'yellow'))
print(colored("Running init()", 'yellow'))
self._init_func()
flask_app = self._create_flask_app()
server = make_server(host, port, flask_app)
Expand Down

0 comments on commit b164bf3

Please sign in to comment.