Skip to content

Commit

Permalink
Fix optional value
Browse files Browse the repository at this point in the history
Description can be None in the database
  • Loading branch information
LKajan committed Feb 14, 2025
1 parent 1699821 commit cd4f94e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions database/ryhti_client/ryhti_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class RyhtiPlan(TypedDict, total=False):
otherPlanMaterials: List
planReport: Dict | None
generalRegulationGroups: List[Dict]
planDescription: str
planDescription: str | None
planObjects: List
planRegulationGroups: List
planRegulationGroupRelations: List
Expand Down Expand Up @@ -778,7 +778,10 @@ def get_plan_dictionary(self, plan: models.Plan) -> RyhtiPlan:
plan_dictionary["scale"] = plan.scale
plan_dictionary["geographicalArea"] = self.get_geojson(plan.geom)
# For reasons unknown, Ryhti does not allow multilanguage description.
plan_dictionary["planDescription"] = plan.description.get("fin")
plan_description = (
plan.description.get("fin") if isinstance(plan.description, dict) else None
)
plan_dictionary["planDescription"] = plan_description

# Here come the dependent objects. They are related to the plan directly or
# via the plan objects, so we better fetch the objects first and then move on.
Expand Down

0 comments on commit cd4f94e

Please sign in to comment.