本文整理汇总了Python中Rule.RulePlugin类的典型用法代码示例。如果您正苦于以下问题:Python RulePlugin类的具体用法?Python RulePlugin怎么用?Python RulePlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RulePlugin类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__ (self, key, **kwargs):
RulePlugin.__init__ (self, key)
self.vsrv_num = kwargs.pop('vsrv_num', '')
if key.startswith('tmp'):
return self.GUI_new()
return self.GUI_mod()
示例2: __init__
def __init__ (self, key, title, extension, note, name_desc, validation_fn=None, **kwargs):
RulePlugin.__init__ (self, key)
self.extension = extension
self.name_desc = name_desc
url_apply = URL_APPLY %(extension)
props = ({},{'class': 'noauto'})[key.startswith('tmp')]
table = CTK.PropsTable()
table.Add (title, CTK.TextCfg('%s!%s'%(key, extension), False, props), note)
submit = CTK.Submitter (url_apply)
submit += CTK.Hidden ('key', key)
submit += CTK.Hidden ('vsrv_num', kwargs.pop('vsrv_num', ''))
submit += table
self += submit
# Build validation
if validation_fn:
validation = [('tmp!%s'%(extension), validation_fn),
('vserver![\d]+!rule![\d]+!match!%s'%(extension), validation_fn)]
else:
validation = []
# Public URL
CTK.publish (url_apply, apply, method="POST", validation=validation, extension=extension)
示例3: __init__
def __init__ (self, key, **kwargs):
RulePlugin.__init__ (self, key)
vsrv_num = kwargs.pop('vsrv_num', '')
submit = CTK.Submitter (URL_APPLY)
submit += CTK.Hidden ('key', key)
submit += CTK.Hidden ('vsrv_num', vsrv_num)
self += submit
示例4: __init__
def __init__(self, key, **kwargs):
RulePlugin.__init__(self, key)
vsrv_num = kwargs.pop("vsrv_num", "")
submit = CTK.Submitter(URL_APPLY)
submit += CTK.Hidden("key", key)
submit += CTK.Hidden("vsrv_num", vsrv_num)
self += submit
示例5: __init__
def __init__(self, key, **kwargs):
RulePlugin.__init__(self, key)
is_new = key.startswith("tmp")
idx = [1, 0][is_new]
table = CTK.PropsTable()
table.Add(_("Method"), CTK.ComboCfg("%s!method" % (key), METHODS[idx:]), _(NOTE_METHOD))
submit = CTK.Submitter(URL_APPLY)
submit += CTK.Hidden("key", key)
submit += CTK.Hidden("vsrv_num", kwargs.pop("vsrv_num", ""))
submit += table
self += submit
示例6: __init__
def __init__ (self, key, **kwargs):
RulePlugin.__init__ (self, key)
self.vsrv_num = kwargs.pop('vsrv_num', '')
# Validation, and Public URLs
VAL = [('^%s!from$'%(key), validations.is_ip_or_netmask),
('^%s!from!.+'%(key), validations.is_ip_or_netmask)]
CTK.publish ("^%s"%(URL_APPLY), commit, validation=VAL, method="POST")
if key.startswith('tmp'):
return self.GUI_new()
return self.GUI_mod()
示例7: __init__
def __init__ (self, key, **kwargs):
RulePlugin.__init__ (self, key)
is_new = key.startswith('tmp')
props = ({},{'class': 'noauto'})[is_new]
type_widget = CTK.ComboCfg ('%s!type'%(key), TYPES, props)
type_val = CTK.cfg.get_val ('%s!type'%(key), 'regex')
complete_val = int (CTK.cfg.get_val ('%s!complete'%(key), '0'))
complete = CTK.CheckCfgText ('%s!complete'%(key), False, _('Full header'), props)
table = CTK.PropsTable()
table.Add (_("Complete Header"), complete, _(NOTE_COMPLETE))
if is_new or not complete_val:
table.Add (_('Header'), CTK.ComboCfg('%s!header'%(key), HEADERS, props), _(NOTE_HEADER))
if is_new or not complete_val:
table.Add (_('Type'), type_widget, _(NOTE_TYPES))
if is_new or type_val == 'regex' or complete_val:
table.Add (_('Regular Expression'), CTK.TextCfg('%s!match'%(key), False, props), _(NOTE_MATCH))
if is_new:
type_widget.bind ('change',
"""if ($('#%(type_widget)s').val() == 'regex') {
$('#%(regex)s').show();
} else {
$('#%(regex)s').hide();
}""" %({'type_widget': type_widget.id, 'regex': table[2].id}))
complete.bind ('change',
"""if (! $('#%(complete)s :checkbox')[0].checked) {
$('#%(row1)s').show();
$('#%(row2)s').show();
} else {
$('#%(row1)s').hide();
$('#%(row2)s').hide();
}""" %({'complete': complete.id, 'row1': table[1].id, 'row2': table[2].id}))
submit = CTK.Submitter (URL_APPLY)
submit += CTK.Hidden ('key', key)
submit += CTK.Hidden ('vsrv_num', kwargs.pop('vsrv_num', ''))
submit += table
self += submit
# Validation, and Public URLs
CTK.publish ("^%s"%(URL_APPLY), commit, method="POST")
示例8: __init__
def __init__(self, key, **kwargs):
RulePlugin.__init__(self, key)
props = ({}, {"class": "noauto"})[key.startswith("tmp")]
table = CTK.PropsTable()
table.Add(_("Header"), CTK.ComboCfg("%s!header" % (key), HEADERS, props), _(NOTE_HEADER))
table.Add(_("Regular Expression"), CTK.TextCfg("%s!match" % (key), False, props), _(NOTE_MATCH))
submit = CTK.Submitter(URL_APPLY)
submit += CTK.Hidden("key", key)
submit += CTK.Hidden("vsrv_num", kwargs.pop("vsrv_num", ""))
submit += table
self += submit
# Validation, and Public URLs
CTK.publish(URL_APPLY, apply, method="POST")
示例9: __init__
def __init__ (self, key, **kwargs):
RulePlugin.__init__ (self, key)
is_new = key.startswith('tmp')
idx = (1,0)[is_new]
# Set the first method is empty
if not CTK.cfg.get_val ('%s!method'%(key)):
CTK.cfg ['%s!method'%(key)] = METHODS[idx:][0][0]
table = CTK.PropsTable()
table.Add (_('Method'), CTK.ComboCfg('%s!method'%(key), METHODS[idx:], ({}, {'class': 'noauto'})[is_new]), _(NOTE_METHOD))
submit = CTK.Submitter (URL_APPLY)
submit += CTK.Hidden ('key', key)
submit += CTK.Hidden ('vsrv_num', kwargs.pop('vsrv_num', ''))
submit += table
self += submit
示例10: __init__
def __init__ (self, key, **kwargs):
RulePlugin.__init__ (self, key)
vsrv_num = kwargs.pop('vsrv_num', '')
is_new = key.startswith('tmp')
# Build the GUI
if is_new:
self._GUI_new (key, vsrv_num)
else:
refresh = CTK.Refreshable ({'id': 'plugin_exists'})
refresh.register (lambda: Modify(key, vsrv_num, refresh).Render())
self += refresh
# Validation, and Public URLs
VALS = [("tmp!exists", validations.is_list),
("%s!exists"%(key), validations.is_list)]
CTK.publish ("^%s"%(URL_APPLY), commit, validation=VALS, method="POST")
示例11: __init__
def __init__ (self, key, **kwargs):
RulePlugin.__init__ (self, key)
props = ({},{'class': 'noauto'})[key.startswith('tmp')]
table = CTK.PropsTable()
table.Add (_('Extensions'), CTK.TextCfg('%s!extensions'%(key), False, props), _(NOTE_EXTENSIONS))
submit = CTK.Submitter (URL_APPLY)
submit += CTK.Hidden ('key', key)
submit += CTK.Hidden ('vsrv_num', kwargs.pop('vsrv_num', ''))
submit += table
self += submit
# Validation, and Public URLs
VALS = [("tmp!extensions", validations.is_extension_list),
("%s!extensions"%(key), validations.is_extension_list)]
CTK.publish (URL_APPLY, apply, validation=VALS, method="POST")
示例12: __init__
def __init__ (self, key, **kwargs):
RulePlugin.__init__ (self, key)
self.vsrv_num = kwargs.pop('vsrv_num', '')
props = ({},{'class':'noauto'})[key.startswith('tmp')]
submit = CTK.Submitter (URL_APPLY)
select_all = CTK.Button (_('Select all'))
select_none = CTK.Button (_('Select none'))
select_all.bind ('click', CHECKBOX_JS % 'true' + submit.JS_to_submit())
select_none.bind ('click', CHECKBOX_JS % 'false' + submit.JS_to_submit())
# GUI
submit += select_all
submit += select_none
submit += CheckListFlags ('%s!countries'%(self.key), props)
submit += CTK.Hidden ('key', self.key)
submit += CTK.Hidden ('vsrv_num', self.vsrv_num)
self += submit
示例13: __init__
def __init__ (self, key, **kwargs):
RulePlugin.__init__ (self, key)
is_new = key.startswith('tmp')
props = ({},{'class': 'noauto'})[is_new]
op_widget = CTK.ComboCfg ('%s!op'%(key), OPERATORS, props)
op_val = CTK.cfg.get_val ('%s!op'%(key), 'regex')
table = CTK.PropsTable()
table.Add (_('Property'), CTK.ComboCfg('%s!stat'%(key), STATPROPS, props), _(NOTE_STATPROP))
table.Add (_('Operator'), op_widget, _(NOTE_OPERATOR))
table.Add (_('Unix Timestamp'), CTK.TextCfg('%s!time'%(key), False, props), _(NOTE_TIMESTAMP))
submit = CTK.Submitter (URL_APPLY)
submit += CTK.Hidden ('key', key)
submit += CTK.Hidden ('vsrv_num', kwargs.pop('vsrv_num', ''))
submit += table
self += submit
# Validation, and Public URLs
CTK.publish (URL_APPLY, commit, method="POST")