Helpers
date_or_none(date_object_or_string)
¶
Try and convert the given object into a datetime; if not possible, return None.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date_object_or_string |
a datetime or date string |
required |
Returns:
Type | Description |
---|---|
datetime or None |
Source code in ckanext/doi/lib/helpers.py
47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
doi_test_mode()
¶
Determines whether we're running in test mode.
Returns:
Type | Description |
---|---|
bool |
Source code in ckanext/doi/lib/helpers.py
62 63 64 65 66 67 68 |
|
get_site_title()
¶
Helper function to return the config site title, if it exists.
Returns:
Type | Description |
---|---|
str site title |
Source code in ckanext/doi/lib/helpers.py
26 27 28 29 30 31 32 |
|
get_site_url()
¶
Get the site URL.
Try and use ckanext.doi.site_url but if that's not set use ckan.site_url.
Source code in ckanext/doi/lib/helpers.py
35 36 37 38 39 40 41 42 43 44 |
|
package_get_year(pkg_dict)
¶
Helper function to return the package year published.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pkg_dict |
return: |
required |
Source code in ckanext/doi/lib/helpers.py
14 15 16 17 18 19 20 21 22 23 |
|