Project

General

Profile

Parameters

Parameters are central to the plugin and they are managed at the evaluation_system.api.parameters module. Here a brief summary about what they can do and how they can be used.

ParameterDictionary

This class manages everything related to the set of parameters the plugin uses. It's an ordered dictionary so the order in which parameters are defined is the order in which they will be presented to the user in the help, configuration files, web forms, etc.

ParameterType

This is the central Class handling parameters. Normally you use another class that inherits functionality from this one, but as most of the functionality is define by this class, we will describe the options used in the constructor and therefore in all other classes inheriting from this one.

Option Default Value Description
name None Name of the parameter
default None The default value if none is provided (this value will also be validated and parsed, so it must be a valid parameter value!)
mandatory False If the parameter is required (note that if there's a default value, the user might not be required to set it, and can always change it, though he/she is not allowed to unset it)
max_items 1 If set to > 1 it will cause the values to be returned in a list (even if the user only provided 1). An error will be risen if more values than those are passed to the plugin
item_separator , The string used to separate multiple values for this parameter. In some cases (at the shell, web interface, etc) the user have always the option to provide multiple values by re-using the same parameter name (e.g. param1=a param1=b produces {'param1': ['a', 'b']}). But the configuration file does not allow this at this time. Therefore is better to setup a separator, even though the user might not use it while giving input. It must not be a character, it can be any string (make sure it's not a valid value!!)
regex .* A regular expression defining valid "string" values before parsing them to their defining classes (e.g. an Integer might define a regex of "[0-9]+" to prevent getting negative numbers). This will be used also on Javascript so don't use fancy expressions or make sure they are understood by both python and Javascript.
help No help available. The help string describing what this parameter is good for.
print_format %s A python string format that will be used when displaying the value of this parameter (e.g. %.2f to display always 2 decimals for floats)

Available Parameters

String:
  • validated as string
Float
  • validated as float
Integer
  • validated as integer
File
  • validated as string
  • shows select file widget on the website
Directory
  • validated as string
  • system does autmatically append a unique id
InputDirectory
  • validated as string
  • system does not autmatically append a unique id
CacheDirectory
  • validated as string
Bool
  • validated as boolean
  • shows radio buttons on the website
SolrField
  • shows solr_widget on the website
  • takes additional parameters:
    • facet: CMOR facet (required)
    • group: If you have more than one solr group in your plugin like MurCSS (default=1)
    • multiple: Allow multiple selections (default=False)
    • predefined_facets: Fix some facets for the data search (default=None)
SelectField
  • only speficied values can be selected
  • takes additional parameters:
    • options: python dictionary with "key":"value" pairs