forked from rDrama/rDrama
dffd
parent
2bb644e2c3
commit
aedb74c912
|
@ -82,31 +82,24 @@ def get_account(base36id, v=None, graceful=False):
|
||||||
|
|
||||||
def get_post(pid, v=None, graceful=False, **kwargs):
|
def get_post(pid, v=None, graceful=False, **kwargs):
|
||||||
|
|
||||||
print('aaa')
|
|
||||||
if isinstance(pid, str):
|
if isinstance(pid, str):
|
||||||
i = base36decode(pid)
|
i = base36decode(pid)
|
||||||
else:
|
else:
|
||||||
i = pid
|
i = pid
|
||||||
print('bbb')
|
|
||||||
|
|
||||||
if v:
|
if v:
|
||||||
print('ccc')
|
|
||||||
vt = g.db.query(Vote).filter_by(
|
vt = g.db.query(Vote).filter_by(
|
||||||
user_id=v.id, submission_id=i).subquery()
|
user_id=v.id, submission_id=i).subquery()
|
||||||
blocking = v.blocking.subquery()
|
blocking = v.blocking.subquery()
|
||||||
print('ddd')
|
|
||||||
|
|
||||||
items = g.db.query(
|
items = g.db.query(
|
||||||
Submission,
|
Submission,
|
||||||
vt.c.vote_type,
|
vt.c.vote_type,
|
||||||
blocking.c.id,
|
blocking.c.id,
|
||||||
)
|
)
|
||||||
print('eee')
|
|
||||||
|
|
||||||
if v.admin_level>=4:
|
if v.admin_level>=4:
|
||||||
items=items.options(joinedload(Submission.oauth_app))
|
items=items.options(joinedload(Submission.oauth_app))
|
||||||
print('fff')
|
|
||||||
print(i)
|
|
||||||
items=items.filter(Submission.id == i
|
items=items.filter(Submission.id == i
|
||||||
).join(
|
).join(
|
||||||
vt,
|
vt,
|
||||||
|
@ -118,30 +111,21 @@ def get_post(pid, v=None, graceful=False, **kwargs):
|
||||||
isouter=True
|
isouter=True
|
||||||
)
|
)
|
||||||
|
|
||||||
print(items.all())
|
|
||||||
items=items.first()
|
items=items.first()
|
||||||
print('ggg')
|
|
||||||
|
|
||||||
if not items and not graceful:
|
if not items and not graceful:
|
||||||
abort(404)
|
abort(404)
|
||||||
print('sexcuse me')
|
|
||||||
x = items[0]
|
x = items[0]
|
||||||
x._voted = items[1] or 0
|
x._voted = items[1] or 0
|
||||||
x._is_blocking = items[2] or 0
|
x._is_blocking = items[2] or 0
|
||||||
print("what")
|
|
||||||
else:
|
else:
|
||||||
print(i)
|
|
||||||
items = g.db.query(
|
items = g.db.query(
|
||||||
Submission
|
Submission
|
||||||
).filter(Submission.id == i).first()
|
).filter(Submission.id == i).first()
|
||||||
print(items)
|
|
||||||
print('help')
|
|
||||||
if not items and not graceful:
|
if not items and not graceful:
|
||||||
abort(404)
|
abort(404)
|
||||||
print('me')
|
|
||||||
x=items
|
x=items
|
||||||
|
|
||||||
print('end of file')
|
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue