Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get template id feature #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@
" if resource:\n",
" return resource['o:id']\n",
"\n",
" def get_template_id(self, label):\n",
" '''\n",
" Get the numeric identifier associated with the supplied template label.\n",
"\n",
" Parameters:\n",
" * `label` - template label used in the omeka instance (eg: 'creation')\n",
"\n",
" Returns:\n",
" * numeric identifier\n",
" '''\n",
" resource = self.get_template_by_label(label)\n",
" if resource:\n",
" return resource['o:id']\n",
"\n",
" def filter_items(self, params, **extra_filters):\n",
" for filter_type in ['resource_template_id', 'resource_class_id', 'item_set_id', 'is_public']:\n",
" filter_value = extra_filters.get(filter_type)\n",
Expand Down
14 changes: 14 additions & 0 deletions omeka_s_tools/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,20 @@ def get_property_id(self, term):
resource = self.get_resource_by_term(term=term)
if resource:
return resource['o:id']

def get_template_id(self, label):
'''
Get the numeric identifier associated with the supplied template label.

Parameters:
* `label` - template label used in the omeka instance (eg: 'creation')

Returns:
* numeric identifier
'''
resource = self.get_template_by_label(label)
if resource:
return resource['o:id']

def filter_items(self, params, **extra_filters):
for filter_type in ['resource_template_id', 'resource_class_id', 'item_set_id', 'is_public']:
Expand Down