From dd5c28d5379236f0c398f0bbfe07a7e2dfe55a85 Mon Sep 17 00:00:00 2001
From: Sam Foster <sf00563@surrey.ac.uk>
Date: Sat, 13 Mar 2021 20:16:03 +0000
Subject: [PATCH] remove services import

---
 .DS_Store    | Bin 0 -> 6148 bytes
 movies.py    |  14 +++++++++-----
 showtimes.py |  15 ++++++++++-----
 3 files changed, 19 insertions(+), 10 deletions(-)
 create mode 100644 .DS_Store

diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..bcf40641d6ad22c7414f94fe7cc96c97cc7ac61e
GIT binary patch
literal 6148
zcmeHKJ5Izv47DLeB$||zbA`RZC|XXi7l05tq!iihQ|-Ap8qXggq6BFhn$@#pzZs9;
zM0rIVi-`7@@gUNPNDDWVtA(xEx%tK(GNV8^?il1vX89QB_s>oBe!{q|jNqN&zxcy6
z-FnCV&CF5(DnJFO02QDDdkR?Zg|$zCj8uRMP=Ox>?E6sQhBa{s^iKzZj{v|1X*aBW
zmH-w@0BhnBhzv}F3Jj{|h@nA8zGPiZTmpkGn!|_YlQkz4^{3<h;^m?>kdX>dfwcmU
zvF)t?zrg>P|JNk$r~nnXD+RPUo{l|UDSPYY<*e5h_$%CMzTjq9I|aepG0@vFHr9@x
dy(sF6t#Muxmq4c@?{px4222+k75Hxjz5!xD6<z=U

literal 0
HcmV?d00001

diff --git a/movies.py b/movies.py
index 9f6a2e2..355e8cb 100644
--- a/movies.py
+++ b/movies.py
@@ -1,5 +1,5 @@
-from services import root_dir, nice_json
 from flask import Flask
+import flask_nicely
 from werkzeug.exceptions import NotFound
 import json
 import os
@@ -10,16 +10,19 @@ with open("{}/database/movies.json".format(os.getcwd()), "r") as f:
 
 
 @app.route("/", methods=['GET'])
+@flask_nicely.nice_json
 def hello():
-    return nice_json({
+    data = {
         "uri": "/",
         "subresource_uris": {
             "movies": "/movies",
             "movie": "/movies/<id>"
         }
-    })
+    }
+    return data
 
 @app.route("/movies/<movieid>", methods=['GET'])
+@flask_nicely.nice_json
 def movie_info(movieid):
     if movieid not in movies:
         raise NotFound
@@ -27,12 +30,13 @@ def movie_info(movieid):
     result = movies[movieid]
     result["uri"] = "/movies/{}".format(movieid)
 
-    return nice_json(result)
+    return result
 
 
 @app.route("/movies", methods=['GET'])
+@flask_nicely.nice_json
 def movie_record():
-    return nice_json(movies)
+    return movies
 
 
 if __name__ == "__main__":
diff --git a/showtimes.py b/showtimes.py
index f4d236c..74ac81e 100644
--- a/showtimes.py
+++ b/showtimes.py
@@ -1,5 +1,5 @@
-from services import root_dir, nice_json
 from flask import Flask
+import flask_nicely
 from werkzeug.exceptions import NotFound
 import json
 import os
@@ -12,27 +12,32 @@ with open("{}/database/showtimes.json".format(os.getcwd()), "r") as f:
 
 
 @app.route("/", methods=['GET'])
+@flask_nicely.nice_json
 def hello():
-    return nice_json({
+    
+    data = {
         "uri": "/",
         "subresource_uris": {
             "showtimes": "/showtimes",
             "showtime": "/showtimes/<date>"
         }
-    })
+    }
+    return data
 
 
 @app.route("/showtimes", methods=['GET'])
+@flask_nicely.nice_json
 def showtimes_list():
-    nice_json(showtimes)
+    return showtimes
 
 
 @app.route("/showtimes/<date>", methods=['GET'])
+@flask_nicely.nice_json
 def showtimes_record(date):
     if date not in showtimes:
         raise NotFound
     print(showtimes[date])
-    return nice_json(showtimes[date])
+    return showtimes[date]
 
 if __name__ == "__main__":
     app.run(port=5002, debug=True)
-- 
GitLab