Skip to content

Commit

Permalink
chore: Tidy up stadtzhharvest_find_or_create_organization
Browse files Browse the repository at this point in the history
- We never use the return value of this function (and it is not needed, as the function modifies the package_dict in place), so let's remove it.
- Specify the exception type that we're catching.
  • Loading branch information
bellisk committed May 6, 2024
1 parent 9e5db04 commit fb783f0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ckanext/stadtzhharvest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ckan import model
from ckan.lib.munge import munge_title_to_name
from ckan.lib.navl import validators
from ckan.logic import get_action
from ckan.logic import get_action, NotFound
from ckan.model import Session

from ckanext.stadtzhtheme.plugin import StadtzhThemePlugin
Expand All @@ -33,8 +33,7 @@ def stadtzhharvest_find_or_create_organization(package_dict):
package_dict["owner_org"] = get_action("organization_show")(
context.copy(), data_dict
)["id"]
return package_dict
except Exception:
except NotFound:
data_dict = {
"permission": "edit_group",
"id": munge_title_to_name(ORGANIZATION["de"]),
Expand All @@ -43,7 +42,6 @@ def stadtzhharvest_find_or_create_organization(package_dict):
}
organization = get_action("organization_create")(context.copy(), data_dict)
package_dict["owner_org"] = organization["id"]
return package_dict


def stadtzhharvest_create_new_context():
Expand Down

0 comments on commit fb783f0

Please sign in to comment.