##// END OF EJS Templates
pull-requests: fix potential crash on providing a wrong order-by type column.
super-admin -
r4716:09a1d944 default
parent child Browse files
Show More
@@ -345,14 +345,14 b' class PullRequestModel(BaseModel):'
345 345 if only_created:
346 346 q = q.filter(PullRequest.pull_request_state == PullRequest.STATE_CREATED)
347 347
348 if order_by:
349 order_map = {
350 'name_raw': PullRequest.pull_request_id,
351 'id': PullRequest.pull_request_id,
352 'title': PullRequest.title,
353 'updated_on_raw': PullRequest.updated_on,
354 'target_repo': PullRequest.target_repo_id
355 }
348 order_map = {
349 'name_raw': PullRequest.pull_request_id,
350 'id': PullRequest.pull_request_id,
351 'title': PullRequest.title,
352 'updated_on_raw': PullRequest.updated_on,
353 'target_repo': PullRequest.target_repo_id
354 }
355 if order_by and order_by in order_map:
356 356 if order_dir == 'asc':
357 357 q = q.order_by(order_map[order_by].asc())
358 358 else:
@@ -499,13 +499,13 b' class PullRequestModel(BaseModel):'
499 499 pull_request_alias.description.ilike(like_expression),
500 500 ))
501 501
502 if order_by:
503 order_map = {
504 'name_raw': pull_request_alias.pull_request_id,
505 'title': pull_request_alias.title,
506 'updated_on_raw': pull_request_alias.updated_on,
507 'target_repo': pull_request_alias.target_repo_id
508 }
502 order_map = {
503 'name_raw': pull_request_alias.pull_request_id,
504 'title': pull_request_alias.title,
505 'updated_on_raw': pull_request_alias.updated_on,
506 'target_repo': pull_request_alias.target_repo_id
507 }
508 if order_by and order_by in order_map:
509 509 if order_dir == 'asc':
510 510 q = q.order_by(order_map[order_by].asc())
511 511 else:
@@ -585,13 +585,14 b' class PullRequestModel(BaseModel):'
585 585 PullRequest.title.ilike(like_expression),
586 586 PullRequest.description.ilike(like_expression),
587 587 ))
588 if order_by:
589 order_map = {
590 'name_raw': PullRequest.pull_request_id,
591 'title': PullRequest.title,
592 'updated_on_raw': PullRequest.updated_on,
593 'target_repo': PullRequest.target_repo_id
594 }
588
589 order_map = {
590 'name_raw': PullRequest.pull_request_id,
591 'title': PullRequest.title,
592 'updated_on_raw': PullRequest.updated_on,
593 'target_repo': PullRequest.target_repo_id
594 }
595 if order_by and order_by in order_map:
595 596 if order_dir == 'asc':
596 597 q = q.order_by(order_map[order_by].asc())
597 598 else:
@@ -665,13 +666,13 b' class PullRequestModel(BaseModel):'
665 666 pull_request_alias.description.ilike(like_expression),
666 667 ))
667 668
668 if order_by:
669 order_map = {
670 'name_raw': pull_request_alias.pull_request_id,
671 'title': pull_request_alias.title,
672 'updated_on_raw': pull_request_alias.updated_on,
673 'target_repo': pull_request_alias.target_repo_id
674 }
669 order_map = {
670 'name_raw': pull_request_alias.pull_request_id,
671 'title': pull_request_alias.title,
672 'updated_on_raw': pull_request_alias.updated_on,
673 'target_repo': pull_request_alias.target_repo_id
674 }
675 if order_by and order_by in order_map:
675 676 if order_dir == 'asc':
676 677 q = q.order_by(order_map[order_by].asc())
677 678 else:
General Comments 0
You need to be logged in to leave comments. Login now