diff --git a/ckanext/odsh/collection/helpers.py b/ckanext/odsh/collection/helpers.py index 84fa3e1865a805c0dd1d54f50aa20e6cf46bcdfb..f3b4e73dba5e0926579d6c947075ab93c7b8416a 100644 --- a/ckanext/odsh/collection/helpers.py +++ b/ckanext/odsh/collection/helpers.py @@ -75,7 +75,7 @@ def gather_collection_info(collection_dict, datasets_in_collection, dataset_dict name_collection = collection_dict.get('name') persistent_link_last_member = url_last_member(name_collection) - url_collection = url_from_id(collection_dict.get('id')) + url_collection = url_from_id(collection_dict.get('name')) if dataset_dict: name_current_dataset = dataset_dict.get('name') diff --git a/ckanext/odsh/i18n/ckanext-odsh.pot b/ckanext/odsh/i18n/ckanext-odsh.pot index 32e57994a11c31e0a7e4d6ffb4bd0a9ab4536676..8fbf82b38e4741db0051de265a8b266b4df8c498 100644 --- a/ckanext/odsh/i18n/ckanext-odsh.pot +++ b/ckanext/odsh/i18n/ckanext-odsh.pot @@ -1,14 +1,14 @@ # Translations template for ckanext-odsh. -# Copyright (C) 2019 ORGANIZATION +# Copyright (C) 2021 ORGANIZATION # This file is distributed under the same license as the ckanext-odsh project. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2019. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2021. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: ckanext-odsh 0.0.1\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2019-10-08 12:09+0000\n" +"POT-Creation-Date: 2021-04-15 13:23+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -17,41 +17,41 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.3.4\n" -#: ckanext/odsh/plugin.py:158 ckanext/odsh/plugin.py:165 ckanext/odsh/plugin.py:171 +#: ckanext/odsh/plugin.py:176 ckanext/odsh/plugin.py:183 ckanext/odsh/plugin.py:189 msgid "Herausgeber" msgstr "" -#: ckanext/odsh/plugin.py:159 ckanext/odsh/plugin.py:168 ckanext/odsh/plugin.py:174 +#: ckanext/odsh/plugin.py:177 ckanext/odsh/plugin.py:186 ckanext/odsh/plugin.py:192 msgid "Kategorie" msgstr "" -#: ckanext/odsh/plugin.py:160 +#: ckanext/odsh/plugin.py:178 msgid "Informationsgegenstand" msgstr "" -#: ckanext/odsh/plugin.py:161 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:223 +#: ckanext/odsh/plugin.py:179 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:225 msgid "Tags" msgstr "" -#: ckanext/odsh/plugin.py:166 ckanext/odsh/plugin.py:172 +#: ckanext/odsh/plugin.py:184 ckanext/odsh/plugin.py:190 msgid "Dateiformat" msgstr "" -#: ckanext/odsh/plugin.py:167 ckanext/odsh/plugin.py:173 +#: ckanext/odsh/plugin.py:185 ckanext/odsh/plugin.py:191 msgid "Lizenz" msgstr "" -#: ckanext/odsh/validation.py:261 +#: ckanext/odsh/validation.py:302 #, python-format msgid "Tag \"%s\" must be alphanumeric characters or symbols: -_.:()" msgstr "" -#: ckanext/odsh/validation.py:312 +#: ckanext/odsh/validation.py:353 msgid "Subject must be a known URI." msgstr "" -#: ckanext/odsh/validation.py:334 +#: ckanext/odsh/validation.py:375 msgid "Subject must not be empty." msgstr "" @@ -73,12 +73,12 @@ msgid "Upload" msgstr "" #: ckanext/odsh/fanstatic/odsh_image-upload.js:75 -#: ckanext/odsh/templates/macros/form.html:342 +#: ckanext/odsh/templates/macros/form.html:357 msgid "Remove" msgstr "" #: ckanext/odsh/fanstatic/odsh_image-upload.js:83 -#: ckanext/odsh/templates/macros/form.html:528 +#: ckanext/odsh/templates/macros/form.html:559 msgid "Image" msgstr "" @@ -246,8 +246,8 @@ msgstr "" #: ckanext/odsh/templates/datarequests/snippets/datarequest_form.html:21 #: ckanext/odsh/templates/organization/snippets/organization_form.html:20 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:27 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:32 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:29 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:34 msgid "Description" msgstr "" @@ -260,10 +260,9 @@ msgid "Are you sure you want to delete this data request?" msgstr "" #: ckanext/odsh/templates/datarequests/snippets/datarequest_form.html:30 -#: ckanext/odsh/templates/organization/snippets/organization_form.html:60 +#: ckanext/odsh/templates/organization/snippets/organization_form.html:51 #: ckanext/odsh/templates/package/edit_view.html:19 -#: ckanext/odsh/templates/package/snippets/package_form.html:32 -#: ckanext/odsh/templates/package/snippets/resource_form.html:96 +#: ckanext/odsh/templates/user/edit_user_form.html:48 msgid "Delete" msgstr "" @@ -284,30 +283,30 @@ msgstr "" msgid "Welcome" msgstr "" -#: ckanext/odsh/templates/macros/form.html:374 +#: ckanext/odsh/templates/macros/form.html:405 msgid "Custom" msgstr "" -#: ckanext/odsh/templates/macros/form.html:374 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:59 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:94 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:249 +#: ckanext/odsh/templates/macros/form.html:405 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:61 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:96 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:251 msgid "This field is required" msgstr "" -#: ckanext/odsh/templates/macros/form.html:510 +#: ckanext/odsh/templates/macros/form.html:541 msgid "Required field" msgstr "" -#: ckanext/odsh/templates/macros/form.html:526 +#: ckanext/odsh/templates/macros/form.html:557 msgid "http://example.com/my-image.jpg" msgstr "" -#: ckanext/odsh/templates/macros/form.html:527 +#: ckanext/odsh/templates/macros/form.html:558 msgid "Image URL" msgstr "" -#: ckanext/odsh/templates/macros/form.html:544 +#: ckanext/odsh/templates/macros/form.html:575 msgid "Clear Upload" msgstr "" @@ -316,7 +315,7 @@ msgstr "" #: ckanext/odsh/templates/organization/index.html:33 #: ckanext/odsh/templates/organization/read_base.html:3 #: ckanext/odsh/templates/organization/read_base.html:6 -#: ckanext/odsh/templates/package/base.html:14 +#: ckanext/odsh/templates/package/base.html:21 msgid "Organizations" msgstr "" @@ -368,7 +367,7 @@ msgid "Issued Descending" msgstr "" #: ckanext/odsh/templates/organization/read.html:32 -#: ckanext/odsh/templates/snippets/package_item.html:90 +#: ckanext/odsh/templates/snippets/package_item.html:101 #: ckanext/odsh/templates/snippets/search_form.html:20 msgid "Popular" msgstr "" @@ -379,17 +378,17 @@ msgid "Search datasets..." msgstr "" #: ckanext/odsh/templates/organization/read.html:37 -#: ckanext/odsh/templates/package/base.html:7 -#: ckanext/odsh/templates/package/base.html:17 -#: ckanext/odsh/templates/package/read.html:17 -#: ckanext/odsh/templates/package/read.html:22 +#: ckanext/odsh/templates/package/base.html:14 +#: ckanext/odsh/templates/package/base.html:24 +#: ckanext/odsh/templates/package/read.html:31 +#: ckanext/odsh/templates/package/read.html:39 #: ckanext/odsh/templates/package/search.html:5 -#: ckanext/odsh/templates/snippets/organization.html:59 +#: ckanext/odsh/templates/snippets/organization.html:102 msgid "Documents" msgstr "" #: ckanext/odsh/templates/organization/read_base.html:29 -#: ckanext/odsh/templates/snippets/organization.html:47 +#: ckanext/odsh/templates/snippets/organization.html:90 msgid "There is no description for this organization" msgstr "" @@ -410,32 +409,27 @@ msgstr "" msgid "A little information about my organization..." msgstr "" -#: ckanext/odsh/templates/organization/snippets/organization_form.html:35 -#: ckanext/odsh/templates/organization/snippets/organization_form.html:48 -msgid "Custom Field" -msgstr "" - -#: ckanext/odsh/templates/organization/snippets/organization_form.html:60 +#: ckanext/odsh/templates/organization/snippets/organization_form.html:51 msgid "" "Are you sure you want to delete this Organization? This will delete all the " "public and private datasets belonging to this organization." msgstr "" -#: ckanext/odsh/templates/organization/snippets/organization_form.html:63 +#: ckanext/odsh/templates/organization/snippets/organization_form.html:54 msgid "Save Organization" msgstr "" #: ckanext/odsh/templates/organization/snippets/organization_item.html:15 -#: ckanext/odsh/templates/snippets/package_item.html:75 +#: ckanext/odsh/templates/snippets/package_item.html:87 msgid "View {organization_name}" msgstr "" -#: ckanext/odsh/templates/package/base.html:22 +#: ckanext/odsh/templates/package/base.html:29 msgid "Dokuments" msgstr "" -#: ckanext/odsh/templates/package/base.html:23 -#: ckanext/odsh/templates/package/read.html:23 +#: ckanext/odsh/templates/package/base.html:30 +#: ckanext/odsh/templates/package/read.html:40 msgid "Create Dataset" msgstr "" @@ -466,7 +460,7 @@ msgstr "" #: ckanext/odsh/templates/package/edit_view.html:21 #: ckanext/odsh/templates/package/new_view.html:31 -#: ckanext/odsh/templates/package/read.html:81 +#: ckanext/odsh/templates/package/read.html:116 msgid "Preview" msgstr "" @@ -513,47 +507,47 @@ msgid "" msgstr "" #: ckanext/odsh/templates/package/new_view.html:32 -#: ckanext/odsh/templates/package/snippets/resource_form.html:111 +#: ckanext/odsh/templates/package/snippets/resource_form.html:103 msgid "Add" msgstr "" -#: ckanext/odsh/templates/package/read.html:35 -#: ckanext/odsh/templates/snippets/package_item.html:79 +#: ckanext/odsh/templates/package/read.html:52 +#: ckanext/odsh/templates/snippets/package_item.html:91 msgid "Draft" msgstr "" -#: ckanext/odsh/templates/package/read.html:38 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:279 -#: ckanext/odsh/templates/snippets/organization.html:25 -#: ckanext/odsh/templates/snippets/package_item.html:81 +#: ckanext/odsh/templates/package/read.html:55 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:281 +#: ckanext/odsh/templates/snippets/organization.html:24 +#: ckanext/odsh/templates/snippets/package_item.html:93 msgid "Deleted" msgstr "" -#: ckanext/odsh/templates/package/read.html:44 +#: ckanext/odsh/templates/package/read.html:61 msgid "Manage Dataset" msgstr "" -#: ckanext/odsh/templates/package/read.html:51 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:255 -#: ckanext/odsh/templates/snippets/package_item.html:70 +#: ckanext/odsh/templates/package/read.html:68 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:257 +#: ckanext/odsh/templates/snippets/package_item.html:82 msgid "Private" msgstr "" -#: ckanext/odsh/templates/package/read.html:62 -msgid "Publisher" +#: ckanext/odsh/templates/package/read.html:79 +msgid "Detailinformationen" msgstr "" -#: ckanext/odsh/templates/package/read.html:101 +#: ckanext/odsh/templates/package/read.html:139 msgid "latest collection member" msgstr "" -#: ckanext/odsh/templates/package/read.html:106 -#: ckanext/odsh/templates/package/read.html:111 +#: ckanext/odsh/templates/package/read.html:144 +#: ckanext/odsh/templates/package/read.html:149 msgid "predecessor" msgstr "" -#: ckanext/odsh/templates/package/read.html:116 -#: ckanext/odsh/templates/package/read.html:121 +#: ckanext/odsh/templates/package/read.html:154 +#: ckanext/odsh/templates/package/read.html:159 msgid "successor" msgstr "" @@ -660,20 +654,20 @@ msgid "Format" msgstr "" #: ckanext/odsh/templates/package/resource_read.html:170 -#: ckanext/odsh/templates/package/snippets/info.html:94 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:93 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:99 +#: ckanext/odsh/templates/package/snippets/info.html:98 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:95 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:101 msgid "License" msgstr "" #: ckanext/odsh/templates/package/search.html:63 -#: ckanext/odsh/templates/package/snippets/info.html:72 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:142 +#: ckanext/odsh/templates/package/snippets/info.html:75 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:144 msgid "timerange" msgstr "" #: ckanext/odsh/templates/package/search.html:78 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:160 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:162 #: ckanext/odsh/templates/snippets/search_form.html:117 msgid "from" msgstr "" @@ -693,7 +687,7 @@ msgid "wrong_start_date_for_search" msgstr "" #: ckanext/odsh/templates/package/search.html:93 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:174 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:176 #: ckanext/odsh/templates/snippets/search_form.html:144 msgid "to" msgstr "" @@ -724,37 +718,37 @@ msgid "View preview" msgstr "" #: ckanext/odsh/templates/package/snippets/info.html:27 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:85 -#: ckanext/odsh/templates/snippets/package_item.html:114 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:87 +#: ckanext/odsh/templates/snippets/package_item.html:127 msgid "subject" msgstr "" #: ckanext/odsh/templates/package/snippets/info.html:38 -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:237 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:239 msgid "language" msgstr "" -#: ckanext/odsh/templates/package/snippets/info.html:50 -#: ckanext/odsh/templates/snippets/package_item.html:97 +#: ckanext/odsh/templates/package/snippets/info.html:51 +#: ckanext/odsh/templates/snippets/package_item.html:109 msgid " category: " msgid_plural " categories: " msgstr[0] "" msgstr[1] "" -#: ckanext/odsh/templates/package/snippets/info.html:82 -#: ckanext/odsh/templates/snippets/package_item.html:115 +#: ckanext/odsh/templates/package/snippets/info.html:86 +#: ckanext/odsh/templates/snippets/package_item.html:128 msgid "issued" msgstr "" -#: ckanext/odsh/templates/package/snippets/info.html:87 +#: ckanext/odsh/templates/package/snippets/info.html:91 msgid "modified" msgstr "" -#: ckanext/odsh/templates/package/snippets/info.html:110 +#: ckanext/odsh/templates/package/snippets/info.html:114 msgid "share this dataset" msgstr "" -#: ckanext/odsh/templates/package/snippets/info.html:125 +#: ckanext/odsh/templates/package/snippets/info.html:129 msgid "send an email" msgstr "" @@ -762,52 +756,48 @@ msgstr "" msgid "Enter title" msgstr "" -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:36 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:38 msgid "Enter description" msgstr "" -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:58 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:60 msgid "Organization" msgstr "" -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:66 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:68 msgid "No organization" msgstr "" -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:119 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:121 #: ckanext/odsh/templates/user/snippets/login_form.html:23 msgid "enter name" msgstr "" -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:229 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:231 msgid "odsh tags placeholder" msgstr "" -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:243 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:245 msgid "Spatial uri" msgstr "" -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:248 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:250 msgid "Visibility" msgstr "" -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:255 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:257 msgid "Public" msgstr "" -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:269 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:271 msgid "State" msgstr "" -#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:276 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:278 msgid "Active" msgstr "" -#: ckanext/odsh/templates/package/snippets/package_form.html:31 -msgid "Are you sure you want to delete this dataset?" -msgstr "" - -#: ckanext/odsh/templates/package/snippets/package_form.html:38 +#: ckanext/odsh/templates/package/snippets/package_form.html:32 msgid "Next: Add Data" msgstr "" @@ -865,11 +855,7 @@ msgstr "" msgid "eg. CSV, XML or JSON" msgstr "" -#: ckanext/odsh/templates/package/snippets/resource_form.html:95 -msgid "Are you sure you want to delete this resource?" -msgstr "" - -#: ckanext/odsh/templates/package/snippets/resource_form.html:106 +#: ckanext/odsh/templates/package/snippets/resource_form.html:98 msgid "Upload dataset" msgstr "" @@ -885,8 +871,8 @@ msgstr "" msgid "Resource count" msgstr "" -#: ckanext/odsh/templates/package/snippets/resource_item.html:24 -#: ckanext/odsh/templates/package/snippets/resource_item.html:41 +#: ckanext/odsh/templates/package/snippets/resource_item.html:28 +#: ckanext/odsh/templates/package/snippets/resource_item.html:45 msgid "download file" msgstr "" @@ -964,15 +950,19 @@ msgstr "" msgid "map" msgstr "" -#: ckanext/odsh/templates/snippets/organization.html:44 +#: ckanext/odsh/templates/snippets/organization.html:87 msgid "read more" msgstr "" -#: ckanext/odsh/templates/snippets/organization.html:55 +#: ckanext/odsh/templates/snippets/organization.html:98 msgid "Followers" msgstr "" -#: ckanext/odsh/templates/snippets/package_item.html:65 +#: ckanext/odsh/templates/snippets/package_item.html:74 +msgid "historical" +msgstr "" + +#: ckanext/odsh/templates/snippets/package_item.html:77 msgid "NEW" msgstr "" @@ -998,19 +988,19 @@ msgid "Date Descending" msgstr "" #: ckanext/odsh/templates/snippets/search_form.html:16 -msgid "Start Date Descending" +msgid "Start Date Ascending" msgstr "" #: ckanext/odsh/templates/snippets/search_form.html:17 -msgid "Start Date Ascending" +msgid "Start Date Descending" msgstr "" #: ckanext/odsh/templates/snippets/search_form.html:18 -msgid "End Date Descending" +msgid "End Date Ascending" msgstr "" #: ckanext/odsh/templates/snippets/search_form.html:19 -msgid "End Date Ascending" +msgid "End Date Descending" msgstr "" #: ckanext/odsh/templates/snippets/search_form.html:45 @@ -1121,17 +1111,91 @@ msgstr[1] "" msgid "No organizations found" msgstr "" -#: ckanext/odsh/templates/user/login.html:3 -#: ckanext/odsh/templates/user/login.html:6 -#: ckanext/odsh/templates/user/login.html:12 +#: ckanext/odsh/templates/user/edit_user_form.html:9 +msgid "Change details" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:10 +#: ckanext/odsh/templates/user/snippets/login_form.html:22 +msgid "Username" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:12 +msgid "Full name" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:12 +msgid "eg. Joe Bloggs" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:14 +msgid "Email" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:14 +msgid "eg. joe@example.com" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:16 +msgid "About" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:16 +msgid "A little information about yourself" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:19 +msgid "Subscribe to notification emails" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:28 +msgid "Change password" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:31 +msgid "Sysadmin Password" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:31 +msgid "Old Password" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:40 +#: ckanext/odsh/templates/user/snippets/login_form.html:29 +msgid "Password" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:42 +msgid "Confirm Password" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:48 +msgid "Are you sure you want to delete this User?" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:53 +msgid "Are you sure you want to regenerate the API key?" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:53 +msgid "Regenerate API Key" +msgstr "" + +#: ckanext/odsh/templates/user/edit_user_form.html:57 +msgid "Update Profile" +msgstr "" + +#: ckanext/odsh/templates/user/login.html:5 +#: ckanext/odsh/templates/user/login.html:15 +#: ckanext/odsh/templates/user/login.html:21 msgid "Login" msgstr "" -#: ckanext/odsh/templates/user/login.html:25 +#: ckanext/odsh/templates/user/login.html:34 msgid "Forgotten your password?" msgstr "" -#: ckanext/odsh/templates/user/login.html:28 +#: ckanext/odsh/templates/user/login.html:37 msgid "change password" msgstr "" @@ -1148,14 +1212,6 @@ msgstr "" msgid "You are now logged out." msgstr "" -#: ckanext/odsh/templates/user/snippets/login_form.html:22 -msgid "Username" -msgstr "" - -#: ckanext/odsh/templates/user/snippets/login_form.html:29 -msgid "Password" -msgstr "" - #: ckanext/odsh/templates/user/snippets/login_form.html:30 msgid "enter password" msgstr "" diff --git a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo index e5231b5c445d99ba368944a4870058a2d41ed820..1c4da89d6d4406861348878d27777743c76b16af 100644 Binary files a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo and b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo differ diff --git a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po index 67d07054ce4865ff9540a1ace832104c2edeebca..7df7151bd9a9f16195958fb828cf37f1aac2e475 100644 --- a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po +++ b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po @@ -541,4 +541,7 @@ msgid "Name Ascending" msgstr "Name: A – Z" msgid "Name Descending" -msgstr "Name: Z – A" \ No newline at end of file +msgstr "Name: Z – A" + +msgid "historical" +msgstr "historisch" \ No newline at end of file diff --git a/ckanext/odsh/matomo.py b/ckanext/odsh/matomo.py index 15ac1b5c7c70e3413fab7051a14bb6f13e4b0c93..38f12a5e084dc019b6d4a7360ee40a30ea1804ba 100644 --- a/ckanext/odsh/matomo.py +++ b/ckanext/odsh/matomo.py @@ -26,8 +26,8 @@ def create_matomo_request(userId=None): 'HTTPS': False, } fakerequest = FakeRequest(headers) - piwiktracker =PiwikTracker(config.get('ckanext.odsh.matomo_id'), fakerequest) + piwiktracker = PiwikTracker(config.get('ckanext.odsh.matomo_id'), fakerequest) piwiktracker.set_api_url(config.get('ckanext.odsh.matomo_url')) if userId: piwiktracker.set_visitor_id(userId) - enqueue_job(piwiktracker.do_track_page_view,[request.path_qs], queue='tracking') + enqueue_job(piwiktracker.do_track_page_view,[request.path_qs]) diff --git a/ckanext/odsh/profiles/odsh_dcat_de_profile.py b/ckanext/odsh/profiles/odsh_dcat_de_profile.py index d4db9e11a2d64da660feaa7174e5e935b20808ff..373a1f78f76fc04ea9ef0de7fcdd0f3d0a243ddd 100644 --- a/ckanext/odsh/profiles/odsh_dcat_de_profile.py +++ b/ckanext/odsh/profiles/odsh_dcat_de_profile.py @@ -1,4 +1,5 @@ import rdflib +from rdflib.namespace import RDF, FOAF from ckan.common import config import ckan.lib.helpers as helpers @@ -65,18 +66,26 @@ class ODSHDCATdeProfile(DCATdeProfile): # to RDF - + + def graph_from_catalog(self, catalog_dict, catalog_ref): + self.g.set((catalog_ref, DCT.description, rdflib.Literal("Transparenzportal Schleswig-Holstein"))) + organisation = rdflib.URIRef("https://opendata.schleswig-holstein.de/organization/zit-sh") + self.g.add((organisation, RDF.type, DCT.Organisation)) + self.g.add((catalog_ref, DCT.publisher, organisation)) + homepage = rdflib.URIRef("https://transparenz.schleswig-holstein.de") + self.g.add((homepage, RDF.type, FOAF.homepage)) + def graph_from_dataset(self, dataset_dict, dataset_ref): ''' this class inherits from ODSHDCATdeProfile it has been extended to add information to the rdf export - ''' super(ODSHDCATdeProfile, self).graph_from_dataset( dataset_dict, dataset_ref) self._add_contributor_id(dataset_dict, dataset_ref) self._add_license_attribution_by_text(dataset_dict, dataset_ref) + self._add_description(dataset_dict, dataset_ref) self._add_subject(dataset_dict, dataset_ref) self._add_type(dataset_dict, dataset_ref) if self._is_dataset_collection(dataset_dict): @@ -103,6 +112,17 @@ class ODSHDCATdeProfile(DCATdeProfile): self.g.set( (distribution, DCATDE.licenseAttributionByText, rdflib.Literal(licenseAttributionByText)) ) + + def _add_description(self, dataset_dict, dataset_ref): + ''' + adds a node containing dct:description + description is taken from the package's property notes + ''' + description = dataset_dict.get('notes') + description = description if description else "" + self.g.set( + (dataset_ref, DCT.description, rdflib.Literal(description)) + ) def _add_subject(self, dataset_dict, dataset_ref): ''' diff --git a/ckanext/odsh/profiles/odsh_european_dcatap_profile.py b/ckanext/odsh/profiles/odsh_european_dcatap_profile.py index 544323bd1d9b32db11f84e78b93f4a5fb364f92d..f0ff5dc4c09368cd6e97ec1f5b9db9ef8b95f556 100644 --- a/ckanext/odsh/profiles/odsh_european_dcatap_profile.py +++ b/ckanext/odsh/profiles/odsh_european_dcatap_profile.py @@ -9,6 +9,7 @@ from ckanext.dcatde.profiles import DCAT log = logging.getLogger(__name__) DCT = rdflib.namespace.Namespace("http://purl.org/dc/terms/") DCAT = rdflib.namespace.Namespace("http://www.w3.org/ns/dcat#") +IANA_MEDIA_TYPES = rdflib.namespace.Namespace("https://www.iana.org/assignments/media-types/") class ODSHEuropeanDCATAPProfile(EuropeanDCATAPProfile): @@ -49,10 +50,21 @@ class ODSHEuropeanDCATAPProfile(EuropeanDCATAPProfile): super(ODSHEuropeanDCATAPProfile, self).graph_from_dataset( dataset_dict, dataset_ref) for s, p, o in self.g.triples((None, rdflib.RDF.type, DCAT.Distribution)): + # replace short version of dct:format with long version for s2, p2, o2 in self.g.triples((s, DCT['format'], None)): if o2.decode() in resource_formats_export(): - self.g.set((s, DCT['format'], rdflib.URIRef( - resource_formats_export()[o2.decode()]))) + self.g.set( + (s, DCT['format'], rdflib.URIRef(resource_formats_export()[o2.decode()])) + ) + # set dcat:mediaType + for s2, p2, o2 in self.g.triples((s, DCAT['mediaType'], None)): + mediaType = o2.decode() + if mediaType and not mediaType.startswith(IANA_MEDIA_TYPES): + self.g.set( + (s, DCAT['mediaType'], rdflib.URIRef(IANA_MEDIA_TYPES[mediaType])) + ) + + for s, p, o in self.g.triples((None, DCT.language, None)): if o.decode() in get_language(): self.g.set((s, p, rdflib.URIRef(get_language()[o.decode()]))) diff --git a/ckanext/odsh/public/odsh.css b/ckanext/odsh/public/odsh.css index ac27fafd64bb8c367e2453e07cc304c4dc5f46e9..d057098f3448afbdfb61594557ab0f95ca36ee4c 100644 --- a/ckanext/odsh/public/odsh.css +++ b/ckanext/odsh/public/odsh.css @@ -739,6 +739,18 @@ label.rangesearch.disabled { border-bottom: none; } +.historical { + opacity: 0.8; +} + +.historical img { + opacity: 0.6; +} + +.historicat .historical-dataset-label { + opacity: 1; +} + .preview-image-container { display: flex; flex-direction: column; @@ -2363,8 +2375,7 @@ span.clear { { display: inline-block; box-sizing: border-box; - height: 20px; - padding: 3px 10px; + padding: 1px 10px; background-color: #dbdbdb; border-radius: 3px; font-size: 12px; @@ -2608,12 +2619,20 @@ p.package-info-issued { .new-dataset-label { background-color: #d4004b!important;; - padding: 3px 3px 1px 3px; + padding: 2px 3px 2px 3px; font-size: 14px; margin-right: 4px; text-shadow: none; } +.historical-dataset-label +{ + padding: 4px 5px; + background-color: #dbdbdb; + color: #444444; + text-shadow: none; +} + .comments-heading{ color: black; font-weight: normal; diff --git a/ckanext/odsh/templates/package/read.html b/ckanext/odsh/templates/package/read.html index a923666aa7745026d809d871998db125273660dd..579aa09a1a419ff308edd4e03df4eb8224f4127c 100644 --- a/ckanext/odsh/templates/package/read.html +++ b/ckanext/odsh/templates/package/read.html @@ -9,6 +9,14 @@ {% set latest_collection_member = collection['persistent_link_last_member'] if collection else None %} {% set thumbnail_url = h.thumbail_get_download_link(pkg) %} +{% block meta %} +{{ super() }} +{# prevent package from beeing indexed if it is part of collection but not last member #} +{% if successor_url %} +<meta name="robots" content="noindex" /> +{% endif %} +{% endblock meta %} + {% block breadcrumb_content %} {% if pkg %} {% set dataset = h.dataset_display_name(pkg) %} @@ -67,7 +75,7 @@ {% block package_notes %} <div class="btn btn-primary btn-lg show-filters" role="button"> - <img src="/base/images/icon_info.svg" aria-hidden="true"></img> + <img src="/base/images/icon_info.svg" aria-hidden="true" /> {{ _('Detailinformationen') }} </div> {% if successor_url %} diff --git a/ckanext/odsh/templates/package/snippets/package_basic_fields.html b/ckanext/odsh/templates/package/snippets/package_basic_fields.html index 7d24841fd6593de73512134cd155be2f54311251..51474a13afbae3e4ab0a9158914d2c8b71e318b8 100644 --- a/ckanext/odsh/templates/package/snippets/package_basic_fields.html +++ b/ckanext/odsh/templates/package/snippets/package_basic_fields.html @@ -22,6 +22,8 @@ {% endblock package_basic_fields_title %} +{% if data.type != 'collection' %} + {# field note #} {% block package_basic_fields_description %} {% set error_string = _(_('Description') + ': '+errors.notes[0]) if errors.notes %} @@ -324,4 +326,6 @@ dataset_is_draft)) %} </div> </div> </div> -</div> \ No newline at end of file +</div> + +{% endif %} {# if data.type != 'collection' #} \ No newline at end of file diff --git a/ckanext/odsh/templates/snippets/package_item.html b/ckanext/odsh/templates/snippets/package_item.html index 90ea7af05f4a0355d99e29f590a60a11beb52b7c..0867c1d252bac4ff39c3b13798c8a7bc1e345249 100644 --- a/ckanext/odsh/templates/snippets/package_item.html +++ b/ckanext/odsh/templates/snippets/package_item.html @@ -30,9 +30,11 @@ Example: {% set language_of_package = h.tpsh_get_language_of_package(package) %} {% set language_icon = h.get_language_icon(package) %} {% set thumbnail = package.get('thumbnail') %} +{% set collection = h.get_collection(package) %} +{% set successor_url = collection['successor']['url'] if collection else None %} {% block package_item %} -<li class="odsh-dataset-item"> +<li class="odsh-dataset-item {% if successor_url %}historical{% endif %}"> <div class="preview-image-container"> {% if thumbnail %} <a href={{ h.url_for(controller='package', action='read', id=package.name) }}> @@ -68,7 +70,10 @@ Example: <p>{{ org }}</p> <h3 class="dataset-heading"> {% block heading_private %} - {% if package.is_new %} + {% if successor_url %} + <span class='label historical-dataset-label'>{{ _('historical') }}</span> + {% endif %} + {% if package.is_new and not successor_url %} <span class='label new-dataset-label'>{{ _('NEW') }}</span> {% endif %} {% if package.private %} diff --git a/ckanext/odsh/tests_tpsh/test_helpers_collection.py b/ckanext/odsh/tests_tpsh/test_helpers_collection.py index 03f5d02d5e8f6bca040b0e58f10a89b35e679378..b789cfd0286b1b86df59c3d8521bfd6b7f5a7d31 100644 --- a/ckanext/odsh/tests_tpsh/test_helpers_collection.py +++ b/ckanext/odsh/tests_tpsh/test_helpers_collection.py @@ -20,7 +20,7 @@ class TestHelpersCollection(object): ] self.collection_dict = { - 'name': 'collection name', + 'name': 'collection-name', 'id': 'someid', 'title': 'collection title', 'relationships': [ @@ -87,14 +87,14 @@ class TestHelpersCollection(object): def test_get_collection_info_WITHOUT_dataset_dict(self): collection_info = helpers_collection.get_collection_info('some_id') collection_info_expected = { - 'url': 'http://someid', + 'url': 'http://collection-name', 'first_member': { 'name': 'dataset 1', 'url': 'http://dataset 1' }, 'last_member': {'name': 'dataset 3', 'url': 'http://dataset 3'}, 'members': [{'name': 'dataset 1'}, {'name': 'dataset 2'}, {'name': 'dataset 3'}], - 'persistent_link_last_member': 'http://collection name/last', + 'persistent_link_last_member': 'http://collection-name/last', 'predecessor': {'url': None}, 'successor': {'url': None}, 'title': 'collection title' @@ -104,11 +104,11 @@ class TestHelpersCollection(object): def test_get_collection_info_WITH_dataset_dict(self): collection_info = helpers_collection.get_collection_info('some_id', {'name': 'dataset 2'}) collection_info_expected = { - 'url': 'http://someid', + 'url': 'http://collection-name', 'first_member': {'name': 'dataset 1', 'url': 'http://dataset 1'}, 'last_member': {'name': 'dataset 3', 'url': 'http://dataset 3'}, 'members': [{'name': 'dataset 1'}, {'name': 'dataset 2'}, {'name': 'dataset 3'}], - 'persistent_link_last_member': 'http://collection name/last', + 'persistent_link_last_member': 'http://collection-name/last', 'predecessor': {'url': 'http://dataset 1'}, 'successor': {'url': 'http://dataset 3'}, 'title': 'collection title' @@ -150,14 +150,14 @@ class TestHelpersCollection(object): collection_info = helpers_collection.gather_collection_info( self.collection_dict, self.datasets_in_collection, dataset_dict=None) collection_info_expected = { - 'url': 'http://someid', + 'url': 'http://collection-name', 'first_member': {'name': 'dataset 1', 'url': 'http://dataset 1'}, 'last_member': {'name': 'dataset 3', 'url': 'http://dataset 3'}, 'members': [ {'name': 'dataset 1'}, {'name': 'dataset 2'}, {'name': 'dataset 3'}], - 'persistent_link_last_member': 'http://collection name/last', + 'persistent_link_last_member': 'http://collection-name/last', 'predecessor': {'url': None}, 'successor': {'url': None}, 'title': 'collection title' @@ -168,14 +168,14 @@ class TestHelpersCollection(object): collection_info = helpers_collection.gather_collection_info( self.collection_dict, self.datasets_in_collection, dataset_dict={'name': 'dataset 1'}) collection_info_expected = { - 'url': 'http://someid', + 'url': 'http://collection-name', 'first_member': {'name': 'dataset 1', 'url': 'http://dataset 1'}, 'last_member': {'name': 'dataset 3', 'url': 'http://dataset 3'}, 'members': [ {'name': 'dataset 1'}, {'name': 'dataset 2'}, {'name': 'dataset 3'}], - 'persistent_link_last_member': 'http://collection name/last', + 'persistent_link_last_member': 'http://collection-name/last', 'predecessor': {'url': None}, 'successor': {'url': 'http://dataset 2'}, 'title': 'collection title' @@ -186,14 +186,14 @@ class TestHelpersCollection(object): collection_info = helpers_collection.gather_collection_info( self.collection_dict, self.datasets_in_collection, dataset_dict={'name': 'dataset 2'}) collection_info_expected = { - 'url': 'http://someid', + 'url': 'http://collection-name', 'first_member': {'name': 'dataset 1', 'url': 'http://dataset 1'}, 'last_member': {'name': 'dataset 3', 'url': 'http://dataset 3'}, 'members': [ {'name': 'dataset 1'}, {'name': 'dataset 2'}, {'name': 'dataset 3'}], - 'persistent_link_last_member': 'http://collection name/last', + 'persistent_link_last_member': 'http://collection-name/last', 'predecessor': {'url': 'http://dataset 1'}, 'successor': {'url': 'http://dataset 3'}, 'title': 'collection title' @@ -204,14 +204,14 @@ class TestHelpersCollection(object): collection_info = helpers_collection.gather_collection_info( self.collection_dict, self.datasets_in_collection, dataset_dict={'name': 'dataset 3'}) collection_info_expected = { - 'url': 'http://someid', + 'url': 'http://collection-name', 'first_member': {'name': 'dataset 1', 'url': 'http://dataset 1'}, 'last_member': {'name': 'dataset 3', 'url': 'http://dataset 3'}, 'members': [ {'name': 'dataset 1'}, {'name': 'dataset 2'}, {'name': 'dataset 3'}], - 'persistent_link_last_member': 'http://collection name/last', + 'persistent_link_last_member': 'http://collection-name/last', 'predecessor': {'url': 'http://dataset 2'}, 'successor': {'url': None}, 'title': 'collection title' diff --git a/ckanext/odsh/tests_tpsh/test_profiles.py b/ckanext/odsh/tests_tpsh/test_profiles.py index 0d6e859b98e3dcf8ec557ee0df1d2bd0160a9690..ea099dd2ae36b74d421d3467d37696e6b4af7634 100644 --- a/ckanext/odsh/tests_tpsh/test_profiles.py +++ b/ckanext/odsh/tests_tpsh/test_profiles.py @@ -8,6 +8,8 @@ from ckanext.dcat.profiles import URIRefOrLiteral import ckanext.odsh.profiles as profiles import ckanext.odsh.helper_pkg_dict as helper_pkg_dict +import xml.etree.ElementTree as ET + DCT = rdflib.namespace.Namespace("http://purl.org/dc/terms/") @@ -16,6 +18,7 @@ class TestODSHDCATdeProfileParseDatasetWithCollection(object): Tests for ODSHDCATdeProfile.parse_dataset with an rdf file containing a collection ''' + def setUp(self): rdf_graph = Graph() rdf_graph.parse('ckanext/odsh/tests_tpsh/resources/collection1.rdf') @@ -29,43 +32,49 @@ class TestODSHDCATdeProfileParseDatasetWithCollection(object): self.dataset_ref_with_member_not_in_collection = URIRefOrLiteral( 'http://opendata.schleswig-holstein.de/dataset/Test_nicht_in_Collection' ) - + def test_parse_dataset_adds_type_collection_to_dataset_dict(self): dataset_dict = {} - self.profile.parse_dataset(dataset_dict, self.dataset_ref_with_collection) + self.profile.parse_dataset( + dataset_dict, self.dataset_ref_with_collection) nt.assert_equal('collection', dataset_dict['type']) - + def test_parse_dataset_adds_flag_for_collection_member(self): dataset_dict = {} - self.profile.parse_dataset(dataset_dict, self.dataset_ref_with_collection_member) + self.profile.parse_dataset( + dataset_dict, self.dataset_ref_with_collection_member) nt.assert_equal(True, dataset_dict.get('add_to_collection')) - + def test_parse_type_adds_type_collection_to_dataset_dict(self): dataset_dict = {} - self.profile._parse_type(dataset_dict, self.dataset_ref_with_collection) + self.profile._parse_type( + dataset_dict, self.dataset_ref_with_collection) nt.assert_equal('collection', dataset_dict['type']) def test_parse_type_does_not_add_collection_to_dataset_dict(self): dataset_dict = {} - self.profile._parse_type(dataset_dict, self.dataset_ref_with_collection_member) + self.profile._parse_type( + dataset_dict, self.dataset_ref_with_collection_member) nt.assert_not_in('type', dataset_dict) def test_belongs_to_collection_returns_true(self): dataset_dict = {} - assert self.profile._belongs_to_collection(dataset_dict, self.dataset_ref_with_collection_member) + assert self.profile._belongs_to_collection( + dataset_dict, self.dataset_ref_with_collection_member) def test_belongs_to_collection_returns_false(self): dataset_dict = {} belongs_to_collection = self.profile._belongs_to_collection( dataset_dict, self.dataset_ref_with_member_not_in_collection) nt.assert_false(belongs_to_collection) - + class TestODSHDCATdeProfileParseDatasetWithSubject(object): ''' Tests for ODSHDCATdeProfile.parse_dataset with an rdf file containing datasets with subjects ''' + def setUp(self): rdf_graph = Graph() rdf_graph.parse('ckanext/odsh/tests_tpsh/resources/transparenz.rdf') @@ -76,55 +85,59 @@ class TestODSHDCATdeProfileParseDatasetWithSubject(object): def test_parse_subject_returns_subject(self): dataset_dict = {} - self.profile._parse_subject(dataset_dict, self.dataset_ref_with_subject) - nt.assert_equal('http://d-nb.info/gnd/4128022-2', dataset_dict['subject']) - + self.profile._parse_subject( + dataset_dict, self.dataset_ref_with_subject) + nt.assert_equal('http://d-nb.info/gnd/4128022-2', + dataset_dict['subject']) + def test_parse_dataset_returns_subject(self): dataset_dict = {} self.profile.parse_dataset(dataset_dict, self.dataset_ref_with_subject) - nt.assert_equal('http://d-nb.info/gnd/4128022-2', dataset_dict['subject']) + nt.assert_equal('http://d-nb.info/gnd/4128022-2', + dataset_dict['subject']) + + +class GraphFromDatasetBase(object): + def get_graph_and_assert_in(self, dataset_dict, dataset_ref, expected_node): + self.profile.graph_from_dataset(dataset_dict, dataset_ref) + graph_serialized = self.profile.g.serialize() + print(self.profile.g.serialize(format='pretty-xml')) + nt.assert_in(expected_node, graph_serialized) -class TestODSHDCATdeProfileGraphFromDataset(object): +class TestODSHDCATdeProfileGraphFromDataset(GraphFromDatasetBase): ''' Tests for ODSHDCATdeProfile.graph_from_dataset ''' + def setUp(self): rdf_graph = Graph() self.profile = profiles.ODSHDCATdeProfile(rdf_graph) self.dummy_dataset_ref = URIRefOrLiteral('http://some_ref') - - def get_graph_and_assert_in(self, dataset_dict, dataset_ref, expected_node): - self.profile.graph_from_dataset(dataset_dict, dataset_ref) - graph_serialized = self.profile.g.serialize() - print(self.profile.g.serialize(format='pretty-xml')) - nt.assert_in(expected_node, graph_serialized) - - + patch_collection_member = patch.object( - profiles.ODSHDCATdeProfile, - '_dataset_belongs_to_collection', + profiles.ODSHDCATdeProfile, + '_dataset_belongs_to_collection', return_value=True ) - + patch_no_collection_member = patch.object( - profiles.ODSHDCATdeProfile, - '_dataset_belongs_to_collection', + profiles.ODSHDCATdeProfile, + '_dataset_belongs_to_collection', return_value=False ) - @patch_no_collection_member def test_it_adds_dct_subject(self, __): dataset_dict = { 'subject': 'http://some_subject', 'type': 'dataset', 'groups': [], - } + } expected_node = '<dct:subject rdf:resource="http://some_subject"/>' - self.get_graph_and_assert_in(dataset_dict, self.dummy_dataset_ref, expected_node) - - + self.get_graph_and_assert_in( + dataset_dict, self.dummy_dataset_ref, expected_node) + @patch_no_collection_member def test_it_adds_dct_type_collection(self, __): dataset_dict = { @@ -135,13 +148,36 @@ class TestODSHDCATdeProfileGraphFromDataset(object): '<dct:type rdf:resource="http://dcat-ap.de/def/datasetTypes/collection"/>' ) with patch.object( - profiles.ODSHDCATdeProfile, - '_get_dataset_refs_belonging_to_collection', + profiles.ODSHDCATdeProfile, + '_get_dataset_refs_belonging_to_collection', return_value=[] ): - self.get_graph_and_assert_in(dataset_dict, self.dummy_dataset_ref, expected_node) - - + self.get_graph_and_assert_in( + dataset_dict, self.dummy_dataset_ref, expected_node) + + @patch_no_collection_member + def test_it_adds_empty_description(self, __): + dataset_dict = { + 'subject': 'http://some_subject', + 'type': 'dataset', + 'groups': [], + } + expected_node = '<dct:description></dct:description>' + self.get_graph_and_assert_in( + dataset_dict, self.dummy_dataset_ref, expected_node) + + @patch_no_collection_member + def test_it_adds_description(self, __): + dataset_dict = { + 'subject': 'http://some_subject', + 'type': 'dataset', + 'groups': [], + 'notes': 'the description' + } + expected_node = '<dct:description>the description</dct:description>' + self.get_graph_and_assert_in( + dataset_dict, self.dummy_dataset_ref, expected_node) + @patch_no_collection_member def test_it_adds_members_of_collection(self, __): ''' @@ -159,17 +195,19 @@ class TestODSHDCATdeProfileGraphFromDataset(object): # mock get_dataset_refs_belonging_to_collection(context, collection_name) dataset_refs_belonging_to_collection = ['http://id_1', 'http://id_2'] with patch.object( - profiles.ODSHDCATdeProfile, - '_get_dataset_refs_belonging_to_collection', + profiles.ODSHDCATdeProfile, + '_get_dataset_refs_belonging_to_collection', return_value=dataset_refs_belonging_to_collection ): for expected_node in expected_nodes: - self.get_graph_and_assert_in(dataset_dict, self.dummy_dataset_ref, expected_node) - + self.get_graph_and_assert_in( + dataset_dict, self.dummy_dataset_ref, expected_node) + def test_remove_predefined_collection_members(self): rdf_graph = Graph() self.profile = profiles.ODSHDCATdeProfile(rdf_graph) - dummy_ref = rdflib.URIRef('http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63') + dummy_ref = rdflib.URIRef( + 'http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63') refs = ( 'http://transparenz.schleswig-holstein.de/9bbeaf7b503dbd2c667786db08c4512d', 'http://transparenz.schleswig-holstein.de/f6de9c145fe28effe99fc163b92d657e' @@ -181,4 +219,63 @@ class TestODSHDCATdeProfileGraphFromDataset(object): self.profile._remove_predefined_collection_members() graph_serialized = self.profile.g.serialize() for ref in refs: - nt.assert_not_in(ref, graph_serialized) \ No newline at end of file + nt.assert_not_in(ref, graph_serialized) + + +class TestODSHDCATdeProfileGraphFromCatalog(GraphFromDatasetBase): + def setUp(self): + rdf_graph = Graph() + self.profile = profiles.ODSHDCATdeProfile(rdf_graph) + self.dummy_catalog_ref = URIRefOrLiteral('http://some_ref') + + def test_it_adds_dct_description(self): + catalog_dict = {} + self.profile.graph_from_catalog(catalog_dict, self.dummy_catalog_ref) + nt.assert_equal( + self.profile.g.objects( + self.dummy_catalog_ref, DCT.description).next().value, + "Transparenzportal Schleswig-Holstein" + ) + + def test_it_adds_dct_publisher(self): + catalog_dict = {} + self.profile.graph_from_catalog(catalog_dict, self.dummy_catalog_ref) + xml_string = self.profile.g.serialize(format="pretty-xml") + xml_root = ET.fromstring(xml_string) + xml_ns = { + "dct": "http://purl.org/dc/terms/", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + } + organisation = xml_root.find(".//*dct:publisher/dct:Organisation[@rdf:about='https://opendata.schleswig-holstein.de/organization/zit-sh']", xml_ns) + nt.assert_true(organisation is not None) + + def test_it_adds_foaf_Document(self): + catalog_dict = {} + self.profile.graph_from_catalog(catalog_dict, self.dummy_catalog_ref) + xml_string = self.profile.g.serialize(format="pretty-xml") + xml_root = ET.fromstring(xml_string) + xml_ns = { + "dct": "http://purl.org/dc/terms/", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "foaf": "" + } + organisation = xml_root.find(".//*dct:publisher/dct:Organisation[@rdf:about='https://opendata.schleswig-holstein.de/organization/zit-sh']", xml_ns) + nt.assert_true(organisation is not None) + + + +class TestODSHEuropeanDcatapProfileGraphFromDataset(GraphFromDatasetBase): + def setUp(self): + rdf_graph = Graph() + self.profile = profiles.ODSHEuropeanDCATAPProfile(rdf_graph) + self.dummy_dataset_ref = URIRefOrLiteral('http://some_ref') + + def testItWorks(self): + dataset_dict = { + 'title': 'the title', + 'type': 'dataset', + 'groups': [], + } + expected_node = '<dct:title>the title</dct:title>' + self.get_graph_and_assert_in( + dataset_dict, self.dummy_dataset_ref, expected_node) diff --git a/ckanext/odsh/tests_tpsh/test_validation.py b/ckanext/odsh/tests_tpsh/test_validation.py index af27c9ddce151f41aff3537bfffa69021fbe3f25..d4273be8be748a4118003965756abb7d7d4787ab 100644 --- a/ckanext/odsh/tests_tpsh/test_validation.py +++ b/ckanext/odsh/tests_tpsh/test_validation.py @@ -1,3 +1,4 @@ +# This Python file uses the following encoding: utf-8 import nose.tools as nt from ckan.common import config import ckan.logic as logic @@ -8,11 +9,13 @@ from .test_validation_mocks import ( WithAPIValidationMocks, patch_get_dataset, patch_get_dataset_not_found, + patch_translation, ) from ckanext.odsh.validation import ( validate_licenseAttributionByText, validate_extra_groups, validate_relatedPackage, + tag_name_validator, ) @@ -230,4 +233,17 @@ class Test_validate_relatedPackage(object): validate_relatedPackage('some_id') nt.assert_equal( err.exception.error, "relatedPackage: package 'some_id' not found") + + +class Test_validate_tag_name(object): + + def test_tag_name_validator_accepts_allowed_symbols(self): + tag_name = 'abc123-_.:()§ ' + tag_name_validator(tag_name, 'context') + + @patch_translation + def test_throws_error_if_tagname_contains_invalid_symbols(self, patch_trans): + tag_name = 'abc +' + with nt.assert_raises(toolkit.Invalid) as err: + tag_name_validator(tag_name, 'context') \ No newline at end of file diff --git a/ckanext/odsh/tests_tpsh/test_validation_mocks.py b/ckanext/odsh/tests_tpsh/test_validation_mocks.py index 550dca4592c8c6c98e506f324ba7fc9d0a5fb2d4..ba5204e25a22edce9fd70d2e4d3828136f28802a 100644 --- a/ckanext/odsh/tests_tpsh/test_validation_mocks.py +++ b/ckanext/odsh/tests_tpsh/test_validation_mocks.py @@ -2,6 +2,7 @@ import os from ckan.common import config from ckan.lib.navl.dictization_functions import Missing import ckan.logic as logic +import ckan.plugins.toolkit as toolkit from mock import patch import ckanext.odsh.validation as validation @@ -330,4 +331,11 @@ patch_get_dataset_not_found = patch.object( validation, 'get_package_dict', side_effect=logic.NotFound, +) + + +patch_translation = patch.object( + validation, + '_', + return_value='error message for %s' ) \ No newline at end of file diff --git a/ckanext/odsh/validation.py b/ckanext/odsh/validation.py index 6b248cf3e619002b01a1ad70ad0afcb6f75b1822..54361f32d6f7c4420c2e7d1216e56582dfb6c601 100644 --- a/ckanext/odsh/validation.py +++ b/ckanext/odsh/validation.py @@ -297,7 +297,7 @@ def next_extra_index(data): def tag_name_validator(value, context): - tagname_match = re.compile('[\w \-.\:\(\)\´\`]*$', re.UNICODE) + tagname_match = re.compile(r'[\w \-.\:\(\)\´\`\§]*$', re.UNICODE) if not tagname_match.match(value): raise toolkit.Invalid(_('Tag "%s" must be alphanumeric ' 'characters or symbols: -_.:()') % (value)) diff --git a/usecases/collections_harvester.md b/usecases/collections_harvester.md new file mode 100644 index 0000000000000000000000000000000000000000..1ea6a59acc2f9a4125f0242d94b031210976bf87 --- /dev/null +++ b/usecases/collections_harvester.md @@ -0,0 +1,65 @@ + +```plantuml +@startuml +object catalog { + ... + <dcat:Dataset rdf:about="uri_collection"> + \t<dct:type rdf:resource="http://dcat-ap.de/def/datasetTypes/collection" /> + \t<dct:hasVersion rdf:resource="uri1" /> + \t<dct:hasVersion rdf:resource="uri2" /> + </dcat:Dataset> + + ... + <dcat:Dataset rdf:about="uri1"> + \t<dct:isVersionOf rdf:resource="uri_collection" /> + \t... + </dcat:Dataset> + + ... + <dcat:Dataset rdf:about="uri2"> + \t<dct:isVersionOf rdf:resource="uri_collection" /> + \t... + </dcat:Dataset> +} +note right + Falls Collection uri_collection nicht existiert: + Erzeuge Collection + Füge alle Datasets mit isVersionOf uri_collection + zu Collection hinzu +end note + +@enduml +``` + + +```plantuml +@startuml +object catalog { + ... + <dcat:Dataset rdf:about="uri_collection"> + \t<dct:type rdf:resource="http://dcat-ap.de/def/datasetTypes/collection" /> + \t<dct:hasVersion rdf:resource="uri1" /> + \t<dct:hasVersion rdf:resource="uri2" /> + </dcat:Dataset> + + ... + <dcat:Dataset rdf:about="uri1"> + \t<dct:isVersionOf rdf:resource="uri_collection" /> + \t... + </dcat:Dataset> + + ... + <dcat:Dataset rdf:about="uri2"> + \t<dct:isVersionOf rdf:resource="uri_collection" /> + \t... + </dcat:Dataset> +} +note right + Falls Collection uri_collection nicht existiert: + Erzeuge Collection + Füge alle Datasets mit isVersionOf uri_collection + zu Collection hinzu +end note + +@enduml +```