cfme.web_ui.expression_editor_widgetastic module

The expression editor present in some locations of CFME.

class cfme.web_ui.expression_editor_widgetastic.ExpressionEditor(parent, show_loc=None, logger=None)[source]

Bases: widgetastic.widget.View, utils.pretty.Pretty

This class enables to embed the expression in a Form.

Parameters:show_func – Function to call to show the expression if there are more of them.
AND

A class that implements the version picking functionality.

Basic usage is a descriptor in which you place instances of VersionPick in a view. Whenever is this instance accessed from an instance, it automatically picks the correct variant based on product_version defined in the widgetastic.browser.Browser.

You can also use this separately using the pick() method.

Example:

class MyView(View):
    something_version_dependent = VersionPick({
        '1.0.0': Foo('bar'),
        '2.5.0': Bar('baz'),
    })

This sample will resolve the correct (Foo or Bar) kind of item and returns it.

Parameters:version_dict – Dictionary of version_introduced: item
ATOM_ROOT = "./div[@id='exp_atom_editor_div']"
COMMIT

A class that implements the version picking functionality.

Basic usage is a descriptor in which you place instances of VersionPick in a view. Whenever is this instance accessed from an instance, it automatically picks the correct variant based on product_version defined in the widgetastic.browser.Browser.

You can also use this separately using the pick() method.

Example:

class MyView(View):
    something_version_dependent = VersionPick({
        '1.0.0': Foo('bar'),
        '2.5.0': Bar('baz'),
    })

This sample will resolve the correct (Foo or Bar) kind of item and returns it.

Parameters:version_dict – Dictionary of version_introduced: item
DISCARD

A class that implements the version picking functionality.

Basic usage is a descriptor in which you place instances of VersionPick in a view. Whenever is this instance accessed from an instance, it automatically picks the correct variant based on product_version defined in the widgetastic.browser.Browser.

You can also use this separately using the pick() method.

Example:

class MyView(View):
    something_version_dependent = VersionPick({
        '1.0.0': Foo('bar'),
        '2.5.0': Bar('baz'),
    })

This sample will resolve the correct (Foo or Bar) kind of item and returns it.

Parameters:version_dict – Dictionary of version_introduced: item
EXPRESSIONS_ROOT = './fieldset/div'
MAKE_BUTTON = "//span[not(contains(@style,'none'))]//img[@alt='{}']"
NOT

A class that implements the version picking functionality.

Basic usage is a descriptor in which you place instances of VersionPick in a view. Whenever is this instance accessed from an instance, it automatically picks the correct variant based on product_version defined in the widgetastic.browser.Browser.

You can also use this separately using the pick() method.

Example:

class MyView(View):
    something_version_dependent = VersionPick({
        '1.0.0': Foo('bar'),
        '2.5.0': Bar('baz'),
    })

This sample will resolve the correct (Foo or Bar) kind of item and returns it.

Parameters:version_dict – Dictionary of version_introduced: item
OR

A class that implements the version picking functionality.

Basic usage is a descriptor in which you place instances of VersionPick in a view. Whenever is this instance accessed from an instance, it automatically picks the correct variant based on product_version defined in the widgetastic.browser.Browser.

You can also use this separately using the pick() method.

Example:

class MyView(View):
    something_version_dependent = VersionPick({
        '1.0.0': Foo('bar'),
        '2.5.0': Bar('baz'),
    })

This sample will resolve the correct (Foo or Bar) kind of item and returns it.

Parameters:version_dict – Dictionary of version_introduced: item
REDO

A class that implements the version picking functionality.

Basic usage is a descriptor in which you place instances of VersionPick in a view. Whenever is this instance accessed from an instance, it automatically picks the correct variant based on product_version defined in the widgetastic.browser.Browser.

You can also use this separately using the pick() method.

Example:

class MyView(View):
    something_version_dependent = VersionPick({
        '1.0.0': Foo('bar'),
        '2.5.0': Bar('baz'),
    })

This sample will resolve the correct (Foo or Bar) kind of item and returns it.

Parameters:version_dict – Dictionary of version_introduced: item
REMOVE

A class that implements the version picking functionality.

Basic usage is a descriptor in which you place instances of VersionPick in a view. Whenever is this instance accessed from an instance, it automatically picks the correct variant based on product_version defined in the widgetastic.browser.Browser.

You can also use this separately using the pick() method.

Example:

class MyView(View):
    something_version_dependent = VersionPick({
        '1.0.0': Foo('bar'),
        '2.5.0': Bar('baz'),
    })

This sample will resolve the correct (Foo or Bar) kind of item and returns it.

Parameters:version_dict – Dictionary of version_introduced: item
ROOT = "//div[@id='exp_editor_div']"
SELECT_RELATIVE = "//img[@alt='Click to change to a relative Date/Time format']"
SELECT_SPECIFIC = "//img[@alt='Click to change to a specific Date/Time format']"
UNDO

A class that implements the version picking functionality.

Basic usage is a descriptor in which you place instances of VersionPick in a view. Whenever is this instance accessed from an instance, it automatically picks the correct variant based on product_version defined in the widgetastic.browser.Browser.

You can also use this separately using the pick() method.

Example:

class MyView(View):
    something_version_dependent = VersionPick({
        '1.0.0': Foo('bar'),
        '2.5.0': Bar('baz'),
    })

This sample will resolve the correct (Foo or Bar) kind of item and returns it.

Parameters:version_dict – Dictionary of version_introduced: item
any_expression_present()[source]
click_and()[source]
click_commit()[source]
click_discard()[source]
click_not()[source]
click_or()[source]
click_redo()[source]
click_remove()[source]
click_switch_to_relative()[source]
click_switch_to_specific()[source]
click_undo()[source]
count_form_view

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

date_relative_form_view

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

date_specific_form_view

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

delete_whole_expression()[source]
enable_editor()[source]
field_date_form

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

field_form_view

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

fill(*args, **kwargs)[source]
fill_count(count=None, key=None, value=None)[source]

Fills the ‘Count of’ type of form.

If the value is unspecified and we are in the advanced search form (user input), the user_input checkbox will be checked if the value is None.

Parameters:
  • count – Name of the field to compare (Host.VMs, ...).
  • key – Operation to do (=, <, >=, ...).
  • value – Value to check against.

Returns: See cfme.web_ui.fill().

fill_field(field=None, key=None, value=None)[source]

Fills the ‘Field’ type of form.

Parameters:
  • tag – Name of the field to compare (Host.VMs, ...).
  • key – Operation to do (=, <, >=, IS NULL, ...).
  • value – Value to check against.

Returns: See cfme.web_ui.fill().

fill_find(field=None, skey=None, value=None, check=None, cfield=None, ckey=None, cvalue=None)[source]
fill_registry(key=None, value=None, operation=None, contents=None)[source]

Fills the ‘Registry’ type of form.

fill_tag(tag=None, value=None)[source]

Fills the ‘Tag’ type of form.

Parameters:
  • tag – Name of the field to compare.
  • value – Value to check against.
find_form_view

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

is_editing()[source]
no_expression_present()[source]
pretty_attrs = ['show_loc']
read(*args, **kwargs)[source]

Returns whole expression as represented visually.

registry_form_view

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

select_expression_by_text(text)[source]
select_first_expression()[source]

There is always at least one (???), so no checking of bounds.

tag_form_view

This class handles instantiating and caching of the widgets on view.

It stores the class and the parameters it should be instantiated with. Once it is accessed from the instance of the class where it was defined on, it passes the instance to the widget class followed by args and then kwargs.

It also acts as a counter, so you can then order the widgets by their “creation” stamp.

cfme.web_ui.expression_editor_widgetastic.create_program(dsl_program, widget_object)[source]

Simple DSL to fill the expression editor.

Syntax:

DSL consists from statements. Statements are separated with newline or ;. Each statement is a single function call. Functions are called in this module. Function without parameters can be called like this: function or function()

If the function has some parameters, you have to choose whether they are kwargs or args. DSL has no string literals, so if you want to call a function with classic parameters: function(parameter one, parameter two, you cannot use comma) And with kwargs: function(username=John Doe, password=top secret) You cannot split the statement to multiple lines as the DSL is regexp-based.

Parameters:dsl_program – Source string with the program.

Returns: Callable, which fills the expression.

cfme.web_ui.expression_editor_widgetastic.create_program_from_list(command_list, widget_object)[source]

Create function which fills the expression from the command list.

Parameters:command_list – Command list for run_program()

Returns: Callable, which fills the expression.

cfme.web_ui.expression_editor_widgetastic.get_func(name, context)[source]

Return callable from this module by its name.

Parameters:name – Name of the variable containing the callable.

Returns: Callable from this module

cfme.web_ui.expression_editor_widgetastic.run_commands(command_list, clear_expression=True, context=None)[source]

Run commands from the command list.

Command list syntax:
[
    "function1",                                                # no args
    "function2",                                                # dtto
    {"fill_fields": {"field1": "value", "field2": "value"}},    # Passes kwargs
    {"do_other_things": [1,2,3]}                                # Passes args
]
In YAML:
- function1
- function2
-
    fill_fields:
        field1: value
        field2: value
-
    do_other_things:
        - 1
        - 2
        - 3
Parameters:
  • command_listlist object of the commands
  • clear_expression – Whether to clear the expression before entering new one
  • True) ((default) –
  • context – widget object