common.services.utils package

Submodules

common.services.utils.Checkbox module

Checkbox utils

common.services.utils.Checkbox.getCheckBoxBool(cb_value, on_value='on')

if checkbox value is on -> True, else False

common.services.utils.Mail module

Mail Functionality for Web Services

common.services.utils.Mail.mail(from_address, to_address, subject, content, mail_server='smtp.astro-wise.org')

send mail

common.services.utils.Processes module

Module with (web service) process related methods

common.services.utils.Processes.get_child_processes(parentid=None)

Return the process ids of the current process, or the given (parent) process id.

common.services.utils.ToolTips module

Utility class for handling JQuery ToolTips and Dialogs in html

ToolTips are used as popup when the user hovers over an element, they close when the user moves the cursor away from the element.

Dialogs are used to show popups that (1) must be explicitly closed and are opened with a click (2) or opened on hover and closed when the popup looses mouse

class common.services.utils.ToolTips.Dialogs

Bases: common.services.utils.ToolTips.JqueryUiCollection

add(dialog_id, content, opener_id, replace=False, width=600, title='Details', action='click')

add a dialog(tooltip), return the specifier to be included in the html attribute if dialog_id is already present raise Exception, except if replace is set ot True

getJavascript()

return the javascript to initialize the dialogs

id_prefix = 'dialog'
javascript_init = '$( "#%(id)s" ).dialog({autoOpen: false, width: %(width)d, title: "%(title)s"});\n'
javascript_init_click = '$( "#%(id)s" ).dialog({autoOpen: false, width: %(width)d, title: "%(title)s"});\n$( "#%(opener_id)s" ).click(function() {\n if( $( "#%(id)s" ).dialog( "isOpen" ) == true) {\n $("#%(id)s").dialog( "close" );\n } else {\n $( "#%(id)s" ).dialog( "option", "position", {\n my: "top",\n at: "bottom+10",\n of: this // refers to the hovered element\n }).dialog( "open" );\n }\n});\n'
javascript_init_mouseover = '$( "#%(id)s" ).dialog({autoOpen: false, width: %(width)d, title: "%(title)s", show: true, hide: true});\n$( "#%(opener_id)s" ).mouseover(function() {\n if ($( "#%(id)s" ).dialog( "isOpen" ) == false) {\n /*$( "#%(id)s" ).dialog( "open" );*/\n $( "#%(id)s" ).dialog( "option", "position", {\n my: "top",\n at: "bottom+10",\n of: this // refers to the hovered element\n }).dialog( "open" );\n }\n});\n$( "#%(id)s" ).mouseleave(function() {\n $( "#%(id)s" ).dialog( "close" );\n});\n'
class common.services.utils.ToolTips.JqueryUi

Bases: object

base class for jquery UI elements

getHtml()

generate the html div for this jquery UI element

class common.services.utils.ToolTips.JqueryUiCollection

Bases: dict

add_auto_id(*args, **kwargs)

same as method add(), but tooltip_id is generated

getHtml()

return the html to be included for the jquery UI elements

html_template = '\n<div style="display:none;">\n%s\n</div>\n'
class common.services.utils.ToolTips.JqueryUiDialog(content, dialog_id, opener_id, width=600, title='Details', action='click')

Bases: common.services.utils.ToolTips.JqueryUi

class for handling a Jquery UI Dialog

class common.services.utils.ToolTips.JqueryUiTooltip(content, tooltip_id)

Bases: common.services.utils.ToolTips.JqueryUi

class for handling a Jquery UI Tooltip

class common.services.utils.ToolTips.ToolTips

Bases: common.services.utils.ToolTips.JqueryUiCollection

add(tooltip_id, content, replace=False, close_button=False)

Add a tooltip, return the specifier to be included in the html attribute if tooltip_id is already present raise Exception, except if replace is set ot True

getJavascript()

return the javascript to initialize the tooltips

classmethod htmlAttribute(tooltip_id)

return the html attribute for the tooltip

html_attribute = 'tooltip'
id_prefix = 'tooltip'
javascript_init = '\n /* intialize all tooltips */\n $( document ).tooltip({\n items: "[tooltip]",\n content: function() {\n return $(\'#\' + $(this).attr(\'tooltip\')).html();\n }\n });\n'
exception common.services.utils.ToolTips.ToolTipsError

Bases: Exception

Module contents