Skip to content

Commit

Permalink
Merge pull request #504 from gnuboard/fix/error
Browse files Browse the repository at this point in the history
fix: render_latest_posts() 함수 오류 수정
  • Loading branch information
KimTom89 committed Mar 11, 2024
2 parents a78562d + e11e984 commit 45d3484
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions lib/board_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,25 +1378,26 @@ def render_latest_posts(request: Request, skin_name: str = 'basic', bo_table: st
# 캐시된 파일이 있으면 파일을 읽어서 반환
if os.path.exists(cache_file):
return file_cache.get(cache_file)

db = DBConnect().sessionLocal()
# 게시판 설정
board = db.get(Board, bo_table)
board_config = BoardConfig(request, board)
board.subject = board_config.subject

#게시글 목록 조회
write_model = dynamic_create_write_table(bo_table)
writes = db.scalars(
select(write_model)
.where(write_model.wr_is_comment == 0)
.order_by(write_model.wr_num)
.limit(rows)
).all()
for write in writes:
write = get_list(request, write, board_config, subject_len)

db.close()
with DBConnect().sessionLocal() as db:
# 게시판 설정
board = db.get(Board, bo_table)
if not board:
return ""

board_config = BoardConfig(request, board)
board.subject = board_config.subject

#게시글 목록 조회
write_model = dynamic_create_write_table(bo_table)
writes = db.scalars(
select(write_model)
.where(write_model.wr_is_comment == 0)
.order_by(write_model.wr_num)
.limit(rows)
).all()
for write in writes:
write = get_list(request, write, board_config, subject_len)

context = {
"request": request,
Expand Down

0 comments on commit 45d3484

Please sign in to comment.