launchpad: Remove call to dataclasses.asdict on lister state

This generates an error due to the datetime type field, so manually build
the dict instead.

Related to T3003#57551
This commit is contained in:
Antoine Lambert 2021-01-28 19:15:58 +01:00
parent 46f5a50099
commit 5aa7c8f2b2

View file

@ -3,7 +3,7 @@
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from dataclasses import asdict, dataclass
from dataclasses import dataclass
from datetime import datetime
import logging
from typing import Any, Dict, Iterator, Optional
@ -65,8 +65,8 @@ class LaunchpadLister(Lister[LaunchpadListerState, LaunchpadPageType]):
return LaunchpadListerState(**d)
def state_to_dict(self, state: LaunchpadListerState) -> Dict[str, Any]:
d = asdict(state)
date_last_modified = d.get("date_last_modified")
d: Dict[str, Optional[str]] = {"date_last_modified": None}
date_last_modified = state.date_last_modified
if date_last_modified is not None:
d["date_last_modified"] = date_last_modified.isoformat()
return d