forked from rDrama/rDrama
testing bandwidth
parent
c23366843e
commit
d6559471b7
|
@ -1,5 +1,6 @@
|
||||||
from files.classes import *
|
from files.classes import *
|
||||||
from flask import g
|
from flask import g
|
||||||
|
from sqlalchemy.orm import joinedload, undefer
|
||||||
|
|
||||||
def get_id(username, v=None, graceful=False):
|
def get_id(username, v=None, graceful=False):
|
||||||
|
|
||||||
|
@ -40,6 +41,15 @@ def get_user(username, v=None, graceful=False, rendered=False):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if rendered:
|
||||||
|
user = user.options(
|
||||||
|
undefer('reserved'),
|
||||||
|
undefer('profilecss'),
|
||||||
|
undefer('bio'),
|
||||||
|
undefer('friends_html'),
|
||||||
|
undefer('enemies_html')
|
||||||
|
)
|
||||||
|
|
||||||
user = user.one_or_none()
|
user = user.one_or_none()
|
||||||
|
|
||||||
if not user:
|
if not user:
|
||||||
|
@ -149,6 +159,11 @@ def get_post(i, v=None, graceful=False, rendered=False, entered=False):
|
||||||
isouter=True
|
isouter=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if rendered:
|
||||||
|
post = post.options(
|
||||||
|
joinedload(Submission.author)
|
||||||
|
)
|
||||||
|
|
||||||
post=post.one_or_none()
|
post=post.one_or_none()
|
||||||
|
|
||||||
if not post:
|
if not post:
|
||||||
|
@ -199,6 +214,8 @@ def get_posts(pids, v=None):
|
||||||
blocked,
|
blocked,
|
||||||
blocked.c.user_id == Submission.author_id,
|
blocked.c.user_id == Submission.author_id,
|
||||||
isouter=True
|
isouter=True
|
||||||
|
).options(
|
||||||
|
joinedload(Submission.author)
|
||||||
).all()
|
).all()
|
||||||
|
|
||||||
output = [p[0] for p in query]
|
output = [p[0] for p in query]
|
||||||
|
@ -280,6 +297,8 @@ def get_comments(cids, v=None, load_parent=False):
|
||||||
blocked,
|
blocked,
|
||||||
blocked.c.user_id == Comment.author_id,
|
blocked.c.user_id == Comment.author_id,
|
||||||
isouter=True
|
isouter=True
|
||||||
|
).options(
|
||||||
|
joinedload(Comment.post),
|
||||||
).all()
|
).all()
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
|
|
|
@ -47,7 +47,9 @@ def option_votes(option_id, v):
|
||||||
|
|
||||||
if not option: abort(404)
|
if not option: abort(404)
|
||||||
|
|
||||||
ups = g.db.query(SubmissionOptionVote).filter_by(option_id=option_id).all()
|
ups = g.db.query(SubmissionOptionVote).filter_by(option_id=option_id).options(
|
||||||
|
joinedload(SubmissionOptionVote.user)
|
||||||
|
).all()
|
||||||
|
|
||||||
return render_template("poll_votes.html",
|
return render_template("poll_votes.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -97,7 +99,9 @@ def option_votes_comment(option_id, v):
|
||||||
|
|
||||||
if not option: abort(404)
|
if not option: abort(404)
|
||||||
|
|
||||||
ups = g.db.query(CommentOptionVote).filter_by(option_id=option_id).all()
|
ups = g.db.query(CommentOptionVote).filter_by(option_id=option_id).options(
|
||||||
|
joinedload(CommentOptionVote.user)
|
||||||
|
).all()
|
||||||
|
|
||||||
return render_template("poll_votes.html",
|
return render_template("poll_votes.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
|
|
@ -166,6 +166,8 @@ def post_id(pid, anything=None, v=None, sub=None):
|
||||||
blocked,
|
blocked,
|
||||||
blocked.c.user_id == Comment.author_id,
|
blocked.c.user_id == Comment.author_id,
|
||||||
isouter=True
|
isouter=True
|
||||||
|
).options(
|
||||||
|
joinedload(Comment.author),
|
||||||
)
|
)
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
|
|
Loading…
Reference in New Issue