forked from MarseyWorld/MarseyWorld
fix 500 error
parent
9f124e2c8d
commit
100677c1bb
|
@ -315,11 +315,11 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
|
||||||
if (sort == "hot" or (v and v.id == Q_ID)) and page == 1 and ccmode == "false" and not gt and not lt:
|
if (sort == "hot" or (v and v.id == Q_ID)) and page == 1 and ccmode == "false" and not gt and not lt:
|
||||||
if sub:
|
if sub:
|
||||||
pins = g.db.query(Submission).filter(Submission.sub == sub.name, Submission.hole_pinned != None)
|
pins = g.db.query(Submission).filter(Submission.sub == sub.name, Submission.hole_pinned != None)
|
||||||
elif v:
|
else:
|
||||||
pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False)
|
pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False)
|
||||||
pins = pins.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks)))
|
|
||||||
pins = pins.filter(Submission.author_id.notin_(v.userblocks))
|
|
||||||
|
|
||||||
|
if v:
|
||||||
|
pins = pins.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks)))
|
||||||
for pin in pins:
|
for pin in pins:
|
||||||
if pin.stickied_utc and int(time.time()) > pin.stickied_utc:
|
if pin.stickied_utc and int(time.time()) > pin.stickied_utc:
|
||||||
pin.stickied = None
|
pin.stickied = None
|
||||||
|
@ -327,6 +327,9 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
|
||||||
g.db.add(pin)
|
g.db.add(pin)
|
||||||
pins.remove(pin)
|
pins.remove(pin)
|
||||||
|
|
||||||
|
|
||||||
|
if v: pins = pins.filter(Submission.author_id.notin_(v.userblocks))
|
||||||
|
|
||||||
pins = pins.order_by(Submission.created_utc.desc()).all()
|
pins = pins.order_by(Submission.created_utc.desc()).all()
|
||||||
|
|
||||||
posts = pins + posts
|
posts = pins + posts
|
||||||
|
|
Loading…
Reference in New Issue