Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PizzaPalace
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TheJoeCoder
PizzaPalace
Commits
fd317caf
Commit
fd317caf
authored
2 years ago
by
TheJoeCoder
Browse files
Options
Downloads
Patches
Plain Diff
Make open cart function actually work in backend
parent
1b93af34
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/pizza_palace.py
+0
-11
0 additions, 11 deletions
client/pizza_palace.py
server/app.py
+14
-2
14 additions, 2 deletions
server/app.py
with
14 additions
and
13 deletions
client/pizza_palace.py
+
0
−
11
View file @
fd317caf
...
...
@@ -20,17 +20,6 @@ mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
root
.
columnconfigure
(
0
,
weight
=
1
)
root
.
rowconfigure
(
0
,
weight
=
1
)
name_label
=
ttk
.
Label
(
mainframe
,
text
=
"
Pizza Type:
"
)
name_label
.
grid
(
column
=
1
,
row
=
1
,
sticky
=
(
W
,
E
))
name_entry
=
ttk
.
Entry
(
mainframe
,
width
=
10
,
textvariable
=
name
)
name_entry
.
grid
(
column
=
2
,
row
=
1
,
sticky
=
(
W
,
E
))
age_label
=
ttk
.
Label
(
mainframe
,
text
=
"
Age:
"
)
age_label
.
grid
(
column
=
1
,
row
=
2
,
sticky
=
(
W
,
E
))
age_entry
=
ttk
.
Entry
(
mainframe
,
width
=
10
,
textvariable
=
age
)
age_entry
.
grid
(
column
=
2
,
row
=
2
,
sticky
=
(
W
,
E
))
submit_button
=
ttk
.
Button
(
mainframe
,
text
=
"
Go!
"
,
command
=
submit
)
submit_button
.
grid
(
column
=
2
,
row
=
3
,
sticky
=
(
W
,
E
))
...
...
This diff is collapsed.
Click to expand it.
server/app.py
+
14
−
2
View file @
fd317caf
import
json
import
json
,
uuid
,
logging
from
flask
import
Flask
,
request
,
jsonify
,
Response
logger
=
logging
.
Logger
(
__name__
)
app
=
Flask
(
__name__
)
import
config
...
...
@@ -12,15 +14,25 @@ open_carts = {}
@app.route
(
"
/
"
)
def
hello_world
():
# Return OK message
return
"
{
\"
status
\"
:200,
\"
message
\"
:
\"
ok
\"
}
"
,
200
@app.route
(
"
/pizzas
"
,
methods
=
[
"
GET
"
])
def
get_pizzas
():
# Return pizza types
return
jsonify
(
pizza_types
),
200
@app.route
(
"
/cart/open
"
,
methods
=
[
"
POST
"
])
def
open_cart
():
return
"
{
\"
status
\"
:404,
\"
message
\"
:
\"
not implemented
\"
}
"
,
404
# Generate cart id and ensure it is unique
foundunique
=
False
while
not
foundunique
:
cart_id
=
str
(
uuid
.
uuid4
())
if
cart_id
in
open_carts
:
logger
.
warn
(
"
Regenerating UUID for new cart - prev
"
+
cart_id
)
cart_key
=
str
(
uuid
.
uuid4
())
# TODO append cart to list and send to user
return
"
{
\"
status
\"
:200,
\"
id
\"
:
\"
not implemented
\"
,
\"
key
\"
:
\"
not implemented
\"
}
"
,
200
if
__name__
==
"
__main__
"
:
app
.
run
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment