swimlane.core.resources.record module¶
- class swimlane.core.resources.record.Record(*args, **kwargs)[source]¶
Bases:
APIResource
A single Swimlane Record instance
- created¶
Pendulum datetime for Record created date
- Type:
pendulum.DateTime
- modified¶
Pendulum datetime for Record last modified date
- Type:
pendulum.DateTime
- is_new¶
True if Record does not yet exist on server. Other values may be temporarily None if True
- Type:
- add_restriction(*usergroups)[source]¶
Add UserGroup(s) to list of accounts with access to record
New in version 2.16.1.
UserGroups already in the restricted list can be added multiple times and duplicates will be ignored
Notes:
- property app¶
- delete()[source]¶
Delete record from Swimlane server
New in version 2.16.1.
Resets to new state, but leaves field data as-is. Saving a deleted record will create a new Swimlane record
- Raises
ValueError: If record.is_new
- for_json(*field_names)[source]¶
Returns json.dump()-compatible dict representation of the record
New in version 4.1.
Useful for resolving any Cursor, datetime/Pendulum, etc. field values to useful formats outside of Python
- Parameters:
*field_names (str) – Optional subset of field(s) to include in returned dict. Defaults to all fields
- Raises:
UnknownField – Raised if any of field_names not found in parent App
- Returns:
field names -> JSON compatible field values
- Return type:
- get_cache_index_keys()[source]¶
Return values available for retrieving records, but only for already existing records
- get_field(field_name)[source]¶
Get field instance used to get, set, and serialize internal field value
- Parameters:
field_name (str) – Field name or key to retrieve
- Returns:
Requested field instance
- Return type:
- Raises:
UnknownField – Raised if field_name not found in parent App
- patch()[source]¶
Patch record on Swimlane server
- Raises
ValueError: If record.is_new, or if comments or attachments are attempted to be patched
- remove_restriction(*usergroups)[source]¶
Remove UserGroup(s) from list of accounts with access to record
New in version 2.16.1.
Notes:
Warning
Providing no UserGroups will clear the restriction list, opening access to ALL accounts
- Parameters:
*usergroups (UserGroup) – 0 or more Swimlane UserGroup(s) to remove from restriction list
- Raises:
TypeError – If provided a non-UserGroup instance
ValueError – If provided UserGroup not in current restriction list
- property restrictions¶
Returns cached set of retrieved UserGroups in the record’s list of allowed accounts
- save()[source]¶
Persist record changes on Swimlane server
Updates internal raw data with response content from server to guarantee calculated field values match values on server
- Raises:
ValidationError – If any fields fail validation
- validate()[source]¶
Explicitly validate field data
Notes
Called automatically during save call before sending data to server
- Raises:
ValidationError – If any fields fail validation