Skip to content

Commit

Permalink
Merge pull request #24 from ukwhatn/develop
Browse files Browse the repository at this point in the history
Release v3.1.0dev7
  • Loading branch information
ukwhatn authored Sep 28, 2024
2 parents d5d9cb2 + 8313035 commit a3594ac
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "wikidot"
version = "3.1.0dev6"
version = "3.1.0dev7"
authors = [{ name = "ukwhatn", email = "[email protected]" }]
description = "Wikidot Utility Library"
readme = "README.md"
Expand Down
15 changes: 12 additions & 3 deletions src/wikidot/module/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ def create_or_edit(
comment: str = "",
force_edit: bool = False,
raise_on_exists: bool = False,
):
) -> "Page":
site.client.login_check()

# ページロックを取得しにいく
Expand Down Expand Up @@ -694,15 +694,24 @@ def create_or_edit(
}
response = site.amc_request([edit_request_body])[0]

return response.json()
if response.json()["status"] != "ok":
raise exceptions.WikidotStatusCodeException(
f"Failed to create or edit page: {fullname}", response.json()["status"]
)

res = PageCollection.search_pages(site, SearchPagesQuery(fullname=fullname))
if len(res) == 0:
raise exceptions.NotFoundException(f"Page creation failed: {fullname}")

return res[0]

def edit(
self,
title: str = None,
source: str = None,
comment: str = None,
force_edit: bool = False,
):
) -> "Page":
# Noneならそのままにする
title = title or self.title
source = source or self.source.wiki_text
Expand Down
2 changes: 1 addition & 1 deletion src/wikidot/module/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def create(
source: str = "",
comment: str = "",
force_edit: bool = False,
) -> None:
) -> "Page":
"""ページを作成する
Parameters
Expand Down

0 comments on commit a3594ac

Please sign in to comment.