Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Lynchburg Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lynchburg
Lynchburg Server
Commits
eda5874e
Commit
eda5874e
authored
4 years ago
by
Nils G.
Browse files
Options
Downloads
Patches
Plain Diff
Added closed flag to rooms and http status code response 410 GONE
parent
e2e0e634
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
controllers/room.py
+4
-1
4 additions, 1 deletion
controllers/room.py
models/f_room.py
+3
-2
3 additions, 2 deletions
models/f_room.py
modules/http_util.py
+1
-0
1 addition, 0 deletions
modules/http_util.py
with
8 additions
and
3 deletions
controllers/room.py
+
4
−
1
View file @
eda5874e
from
parameter_util
import
JSON_BODY
,
JSON_CONTAINS
from
http_util
import
FAIL
,
CODE_JSON
,
CODE_MISSING
,
CODE_SEMANTIC
from
http_util
import
FAIL
,
CODE_JSON
,
CODE_MISSING
,
CODE_SEMANTIC
,
CODE_GONE
from
room_util
import
ROOM_GET
,
PLAYERS_GET
import
random
...
...
@@ -43,6 +43,9 @@ def status():
if
not
room_record
:
return
(
FAIL
(
CODE_SEMANTIC
))
if
room_record
.
closed
:
return
(
FAIL
(
CODE_GONE
))
players
=
PLAYERS_GET
(
room_record
)
json
=
{
"
players
"
:
players
}
...
...
This diff is collapsed.
Click to expand it.
models/f_room.py
+
3
−
2
View file @
eda5874e
...
...
@@ -7,13 +7,14 @@ db.define_table(
Field
(
'
hashcode
'
,
'
string
'
,
notnull
=
True
),
Field
(
'
player_max
'
,
'
integer
'
,
notnull
=
True
),
Field
(
'
creation
'
,
'
datetime
'
,
default
=
request
.
now
,
notnull
=
True
),
Field
(
'
heartbeat
'
,
'
datetime
'
,
default
=
request
.
now
,
notnull
=
True
)
Field
(
'
heartbeat
'
,
'
datetime
'
,
default
=
request
.
now
,
notnull
=
True
),
Field
(
'
closed
'
,
'
boolean
'
,
default
=
False
)
)
def
generateRoomCode
():
code
=
None
while
not
code
or
db
(
db
.
Room
.
code
==
code
).
count
()
>
0
:
while
not
code
or
db
(
(
db
.
Room
.
code
==
code
)
&
(
db
.
Room
.
closed
==
False
))
.
count
()
>
0
:
code
=
""
for
i
in
range
(
4
):
# Removed characters which could be confused like 0 and O
...
...
This diff is collapsed.
Click to expand it.
modules/http_util.py
+
1
−
0
View file @
eda5874e
...
...
@@ -2,6 +2,7 @@ from gluon import *
CODE_MISSING
=
400
CODE_JSON
=
406
CODE_GONE
=
410
CODE_SEMANTIC
=
422
def
FAIL
(
_code
):
...
...
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