Skip to content

Commit 81a67d3

Browse files
committed
0.5.3:
fix github issues #6 and #7 (Record date fields support datetime.date directly; ROR regular expression syntax warning) address inconsistent JSON API PATCH endpoints. fix output issue with examples/details.py code. Signed-off-by: Neal Ensor <ensorn@osti.gov>
1 parent 7ab1470 commit 81a67d3

6 files changed

Lines changed: 14 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,9 @@
146146

147147
## 0.5.2 - 8/8/2025
148148
- Fix issue with revision history WorkflowStatus (github #3)
149+
150+
## 0.5.3 - 9/2/2025
151+
- Fix issue with ROR ID validation regular expression (github #7)
152+
- Add support for datetime.date on publication_date (github #6)
153+
- Consistently support JSON on various PATCH requests
154+
- fix log output issue on examples/details.py

examples/details.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def audit(logs):
1313
log.audit_date.strftime("%Y-%m-%d %H:%M:%S %z"),
1414
log.status))
1515
for message in log.messages if log.messages else []:
16-
print (" - {message}")
16+
print (f" - {message}")
1717

1818
def print_person(p):
1919
"""

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "elinkapi"
7-
version = "0.5.2"
7+
version = "0.5.3"
88
authors = [
99
{ name="Neal Ensor", email="ensorn@osti.gov" },
1010
{ name="Jacob Samar" }

src/elinkapi/elinkapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def patch_record(self, osti_id, patch, state="save"):
273273
"Authorization" : f"Bearer {self.token}",
274274
"Content-Type": "application/json"
275275
},
276-
data=str(patch))
276+
data=json.dumps(patch))
277277

278278
Validation.handle_response(response)
279279

src/elinkapi/record.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ def parse_date(cls, value) -> date:
255255
"""
256256
format_strings=["%m/%d/%Y", "%m/%d/%y", "%Y-%m-%d"]
257257

258+
# if already a date, we're done here
259+
if isinstance(value, date):
260+
return value
261+
258262
# attempt each format to attempt parsing dates
259263
for format in format_strings:
260264
try:

src/elinkapi/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from .exceptions import NotFoundException,ForbiddenException,UnauthorizedException,ServerException,ConflictException,BadRequestException
33

44
class Validation:
5-
_ROR_ID_PATTERN = re.compile("^(?:(?:(http(s?):\/\/)?(?:ror\.org\/)))?(0[a-hj-km-np-tv-z|0-9]{6}[0-9]{2})$")
5+
_ROR_ID_PATTERN = re.compile(r"^(?:(?:(http(s?)://)?(?:ror\.org\/)))?(0[a-hj-km-np-tv-z|0-9]{6}[0-9]{2})$")
66

77
@classmethod
88
def find_ror_value(cls, value:str) -> str:

0 commit comments

Comments
 (0)