open_file¶
- class camelot.view.action_steps.open_file.OpenFile(path)[source]¶
Open a file with the preferred application from the user. The absolute path is preferred, as this is most likely to work when running from an egg and in all kinds of setups.
Parameters: file_name – the absolute path to the file to open The yield statement will return True if the file was opend successfull.
- class camelot.view.action_steps.open_file.OpenJinjaTemplate(template, context={}, environment=<camelot.core.templates.environment>, suffix='.txt')[source]¶
Render a jinja template into a temporary file and open that file with the prefered application of the user.
Parameters: - environment – a jinja2.Environment object to be used to load templates from.
- template – the name of the template as it can be fetched from the Jinja environment.
- suffix – the suffix of the temporary file to create, this will determine the application used to open the file.
- context – a dictionary with objects to be used when rendering the template
- class camelot.view.action_steps.open_file.OpenStream(stream, suffix='.txt')[source]¶
Write a stream to a temporary file and open that file with the preferred application of the user.
Parameters: - stream – the byte stream to write to a file
- suffix – the suffix of the temporary file
- class camelot.view.action_steps.open_file.OpenString(string, suffix='.txt')[source]¶
Write a string to a temporary file and open that file with the preferred application of the user.
Parameters: - string – the binary string to write to a file
- suffix – the suffix of the temporary file
- class camelot.view.action_steps.open_file.WordJinjaTemplate(template, context={}, environment=<camelot.core.templates.environment>, suffix='.xml')[source]¶
Render a jinja template into a temporary file and open that file with microsoft word through the use of COM objects.
Parameters: - environment – a jinja2.Environment object to be used to load templates from.
- template – the name of the template as it can be fetched from the Jinja environment.
- suffix – the suffix of the temporary file to create, this will determine the application used to open the file.
- context – a dictionary with objects to be used when rendering the template