Bases: object
Value with context that has a name and modification time.
| Parameters: |
|
|---|
File context value as an absolute path or self._val if not a file
Basedir can have multiple base paths separated by ‘:’ like the linux PATH. The first base path for which the content file path exists is returned, or if none exist then the last absolute path will be returned.
Clear the value, modification time, and format (set to None)
Modification time
File context value as a relative path or self._val if not a file.
Basedir can have multiple base paths separated by ‘:’ like the linux PATH. The first base path for which the content file path exists is returned, or if none exist then the last relative path will be returned.
Set or get with the val attribute
Bases: dict
Dictionary class that automatically registers the dict in the module CONTEXT and overrides __setitem__ to create an appropriate ContextValue when assigning to a dict key. If no name is supplied then the ContextDict is not registered in the global CONTEXT.
| Parameters: |
|
|---|
Decorator to cache this ContextDict object
Clear all values in dictionary. The keys are not deleted so that ContextValue references in task decorators maintain validity.
Render val using the template engine and the current context.
| Parameters: | val – input value |
|---|---|
| Returns: | rendered value |
Decorate a function so that the specified arguments are rendered via context.render() before being passed to function. Keyword arguments are unaffected.
Examples:
# Apply render() to all 3 args
@context.render_args()
def func(arg1, arg2, arg3):
return arg1, arg2, arg3
# Render just arg1
@context.render_args(1)
def func(arg1, arg2, arg3):
return arg1, arg2, arg3
# Render arg1 and arg3
@context.render_args(1, 3)
def func(arg1, arg2, arg3):
return arg1, arg2, arg3
Store the current context to filename.
| Parameters: |
|
|---|---|
| Return type: | None |
Update the current context from filename. This file should be created with store_context().
| Parameters: |
|
|---|---|
| Return type: | None |