connect.vanities
connect.vanities
Vanity URL resources.
Classes
| Name | Description |
|---|---|
| Vanities | Manages a collection of vanities. |
| Vanity | A vanity resource. |
| VanityMixin | Mixin class to add a vanity attribute to a resource. |
Vanities
connect.vanities.Vanities(self, ctx)Manages a collection of vanities.
Methods
| Name | Description |
|---|---|
| all | Retrieve all vanities. |
all
connect.vanities.Vanities.all()Retrieve all vanities.
Returns
| Name | Type | Description |
|---|---|---|
List[Vanity] |
Notes
This action requires administrator privileges.
Vanity
connect.vanities.Vanity(self, /, ctx, *, after_destroy=None, **kwargs)A vanity resource.
Vanities maintain custom URL paths assigned to content.
Warnings
Vanity paths may only contain alphanumeric characters, hyphens, underscores, and slashes.
Vanities cannot have children. For example, if the vanity path “/finance/” exists, the vanity path “/finance/budget/” cannot. But, if “/finance” does not exist, both “/finance/budget/” and “/finance/report” are allowed.
The following vanities are reserved by Connect: - /__ - /favicon.ico - /connect - /apps - /users - /groups - /setpassword - /user-completion - /confirm - /recent - /reports - /plots - /unpublished - /settings - /metrics - /tokens - /help - /login - /welcome - /register - /resetpassword - /content
Attributes
| Name | Description |
|---|---|
| AfterDestroyCallback |
Classes
| Name | Description |
|---|---|
| VanityAttributes | Vanity attributes. |
VanityAttributes
connect.vanities.Vanity.VanityAttributes()Vanity attributes.
Attributes
| Name | Description |
|---|---|
| content_guid | |
| created_time | |
| path |
Methods
| Name | Description |
|---|---|
| destroy | Destroy the vanity. |
destroy
connect.vanities.Vanity.destroy()Destroy the vanity.
Raises
| Name | Type | Description |
|---|---|---|
| ValueError | If the foreign unique identifier is missing or its value is None. |
Warnings
This operation is irreversible.
Note
This action requires administrator privileges.
VanityMixin
connect.vanities.VanityMixin(self, ctx, **kwargs)Mixin class to add a vanity attribute to a resource.
Attributes
| Name | Description |
|---|---|
| vanity | Get the vanity. |
Classes
| Name | Description |
|---|---|
| CreateVanityRequest | A request schema for creating a vanity. |
| HasGuid | Has a guid. |
CreateVanityRequest
connect.vanities.VanityMixin.CreateVanityRequest()A request schema for creating a vanity.
Attributes
| Name | Description |
|---|---|
| force | Whether to force creation of the vanity |
| path | The vanity path (e.g., ‘my-dashboard’) |
HasGuid
connect.vanities.VanityMixin.HasGuid()Has a guid.
Attributes
| Name | Description |
|---|---|
| guid |
Methods
| Name | Description |
|---|---|
| create_vanity | Create a vanity. |
| find_vanity | Find the vanity. |
| reset_vanity | Unload the cached vanity. |
create_vanity
connect.vanities.VanityMixin.create_vanity(**kwargs)Create a vanity.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| path | (str, required) |
The path for the vanity. | required |
| force | (bool, not required) |
Whether to force the creation of the vanity. When True, any other vanity with the same path will be deleted. | required |
Warnings
If setting force=True, the destroy operation performed on the other vanity is irreversible.
find_vanity
connect.vanities.VanityMixin.find_vanity()Find the vanity.
Returns
| Name | Type | Description |
|---|---|---|
| Vanity |
reset_vanity
connect.vanities.VanityMixin.reset_vanity()Unload the cached vanity.
Forces the next access, if any, to query the vanity from the Connect server.