Crud
DOIQuery
¶
Source code in ckanext/doi/model/crud.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
create(identifier, package_id, published=None)
classmethod
¶
Create a new record in the DOI table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
a new DOI string |
required | |
package_id |
the id of the package this DOI represents |
required | |
published |
when this DOI was published (datetime, nullable) |
None
|
Returns:
Type | Description |
---|---|
the newly created record object |
Source code in ckanext/doi/model/crud.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
delete_doi(identifier)
classmethod
¶
Delete the record with a given DOI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
the DOI string |
required |
Returns:
Type | Description |
---|---|
True if a record was deleted, False if not |
Source code in ckanext/doi/model/crud.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
delete_package(package_id)
classmethod
¶
Delete the record associated with a given package.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package_id |
the id of the package |
required |
Returns:
Type | Description |
---|---|
True if a record was deleted, False if not |
Source code in ckanext/doi/model/crud.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
read_doi(identifier)
classmethod
¶
Retrieve a record with a given DOI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
the DOI string |
required |
Returns:
Type | Description |
---|---|
the record object |
Source code in ckanext/doi/model/crud.py
34 35 36 37 38 39 40 41 42 |
|
read_package(package_id, create_if_none=False)
classmethod
¶
Retrieve a record associated with a given package.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package_id |
the id of the package |
required | |
create_if_none |
generate a new DOI and add a record if no record is found for the given package |
False
|
Returns:
Type | Description |
---|---|
the record object |
Source code in ckanext/doi/model/crud.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
update_doi(identifier, **kwargs)
classmethod
¶
Update the package_id and/or published fields of a record with a given DOI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
the DOI string |
required | |
kwargs |
the values to be updated |
{}
|
Returns:
Type | Description |
---|---|
the updated record object |
Source code in ckanext/doi/model/crud.py
63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
update_package(package_id, **kwargs)
classmethod
¶
Update the package_id and/or published fields of a record associated with a given package.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package_id |
the id of the package |
required | |
kwargs |
the values to be updated |
{}
|
Returns:
Type | Description |
---|---|
the updated record object |
Source code in ckanext/doi/model/crud.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|