Skip to main content

override_script_prefix

Decorator or context manager to temporary override the script prefix.

Attributes

AttributeTypeDescription
prefixstringThe temporary URL path prefix to be applied during the execution of the decorated function or context block.
old_prefixstringStores the original script prefix retrieved at activation to ensure it can be restored when the context is disabled.

Constructor

Signature

def override_script_prefix(
prefix: string
) - > null

Parameters

NameTypeDescription
prefixstringThe temporary script prefix to be applied.

Signature

def override_script_prefix(
prefix: string
)

Parameters

NameTypeDescription
prefixstringThe temporary script prefix to be set during the execution of the decorated function or context block.

Methods


enable()

@classmethod
def enable() - > null

Activates the override by storing the current script prefix and setting the new prefix globally.

Returns

TypeDescription
nullNothing is returned; the global script prefix state is modified.

disable()

@classmethod
def disable() - > null

Deactivates the override by restoring the script prefix to the original value captured during the enable call.

Returns

TypeDescription
nullNothing is returned; the global script prefix state is restored.