class TemplateFileType
An enumeration-style class that defines constants representing different types of ghosted file templates used in SharePoint or similar content management systems.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/pages/template_file_type.py
1 - 17
simple
Purpose
This class serves as a namespace for template file type constants, providing named integer values to identify different page template types (Standard, Wiki, Form, and Client Side pages). It acts as an enumeration pattern for specifying which template should be used when creating or working with ghosted files in a SharePoint-like environment.
Source Code
class TemplateFileType:
"""Specifies the type of ghosted file template to use"""
def __init__(self):
pass
StandardPage = 0
"""A standard page uses the default view template. Value is 0."""
WikiPage = 1
"""A Wiki page uses the default Wiki template. Value is 1."""
FormPage = 2
"""A form page uses the default form template. Value is 2."""
ClientSidePage = 3
"""A client side page uses the default client side page template."""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
- | - |
Parameter Details
__init__: The constructor takes no parameters and performs no initialization. It exists only to allow instantiation of the class, though the class is primarily intended to be used for its class-level constants rather than through instantiation.
Return Value
Instantiating this class returns a TemplateFileType object with no instance-specific state. The class is designed to be used via its class-level constants (StandardPage, WikiPage, FormPage, ClientSidePage) which return integer values (0, 1, 2, 3 respectively).
Class Interface
Methods
__init__(self) -> None
Purpose: Initializes a TemplateFileType instance with no state
Returns: None - creates an empty instance
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
StandardPage |
int | Constant representing a standard page template type with value 0 | class |
WikiPage |
int | Constant representing a Wiki page template type with value 1 | class |
FormPage |
int | Constant representing a form page template type with value 2 | class |
ClientSidePage |
int | Constant representing a client side page template type with value 3 | class |
Usage Example
# Access template type constants directly from the class
from template_file_type import TemplateFileType
# Use constants without instantiation (recommended)
template_type = TemplateFileType.StandardPage # Returns 0
wiki_type = TemplateFileType.WikiPage # Returns 1
form_type = TemplateFileType.FormPage # Returns 2
client_side_type = TemplateFileType.ClientSidePage # Returns 3
# Example in a function that accepts template type
def create_page(title, template_type):
if template_type == TemplateFileType.WikiPage:
print(f"Creating Wiki page: {title}")
elif template_type == TemplateFileType.FormPage:
print(f"Creating Form page: {title}")
else:
print(f"Creating page with template type: {template_type}")
create_page("My Wiki", TemplateFileType.WikiPage)
# Instantiation is possible but not necessary
template_obj = TemplateFileType()
print(template_obj.StandardPage) # Returns 0
Best Practices
- Use the class constants directly without instantiating the class (e.g., TemplateFileType.StandardPage)
- This class follows an enumeration pattern but predates Python's enum.Enum; consider using enum.IntEnum for new code
- The constants are class-level attributes, not instance attributes, so instantiation is unnecessary
- Use these constants for type-safe comparisons when working with template types
- Do not modify the constant values as they likely correspond to specific values expected by an external system
- Consider this class immutable - do not add or modify attributes at runtime
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class PageType 71.3% similar
-
class DocumentTemplateType 68.6% similar
-
class CalendarType 65.2% similar
-
class SiteType 63.9% similar
-
class CustomizedPageStatus 63.8% similar