Package Camelot :: Package camelot :: Package admin :: Package list_action :: Class OpenFileListAction
[frames] | no frames]

Class OpenFileListAction

source code


List action used to open a file in the prefered application of the user. To be used for example to generate pdfs with reportlab and open them in the default pdf viewer.

Set the suffix class attribute to the suffix the file should have eg: .txt or .pdf

Instance Methods
 
__init__(self, name, icon=Icon('tango/22x22/actions/document-print.png'))
in the list view. :param collection_flush: flush all objects in the collection to the db and refresh them in the views :param selection_flush: flush all objects in the selection to the db and refresh them in the views
source code
 
write_file(self, file_name, collection, selection)
Overwrite this function to generate the file to be opened :arg file_name: the name of the file to which should be written :arg collection: the collection of objects displayed in the list :arg selection: the collection of selected objects in the list
source code

Inherited from ListActionFromModelFunction: run

Inherited from ListAction: render

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  suffix = '.txt'

Inherited from ListAction: Options

Properties

Inherited from object: __class__

Method Details

__init__(self, name, icon=Icon('tango/22x22/actions/document-print.png'))
(Constructor)

source code 
in the list view. :param collection_flush: flush all objects in the collection to the db and refresh them in the views :param selection_flush: flush all objects in the selection to the db and refresh them in the views
Parameters:
  • model_function - a function that has 2 arguments : the collection in the list view and the selection
Overrides: object.__init__