Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: render_latest_posts() 함수 오류 수정 #504

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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