Package Products :: Package ZenEvents :: Module WhereClause |
[hide private]
[frames] | no frames]

# Module WhereClause

source code

Classes | [hide private]
Error
WhereJavaScript Base class for converting to/from javascript
Text Convert to/from javascript for text entries
Select Convert to/from javascript and where clause element for select entries
Compare Convert to/from javascript and where clause elements for numeric comparisons
DeviceGroup
EventClass
Enumerated Convert to/from javascript and where clause elements for enumerated types
_Parser
PythonConversionException Exception thrown when a where clause fails conversion to a Python expression.

Functions | [hide private]
getName(str) | source code
getValue(val) | source code
getEndsWith(name, value) | source code
getStartsWith(name, value) | source code
getIn(name, value) | source code
getNotIn(name, value) | source code
getEquality(name, op, value) | source code
q(s) | source code
toJavaScript(meta, clause) | source code
collapse(tree) Collapses adjacent and/ors into one statement. | source code
toPython(meta, clause) | source code
fromFormVariables(meta, form) | source code

Variables | [hide private]
| log = `logging.getLogger('zen.WhereClause')`
| new_name_mapping = `{'eventClass': 'evt.event_class', 'summary'`...``
| negativeModes = `'!', '!~', '!^',`
| _Definitions = `r`...``
| _ParseSpec = `r`...``
| where = `_Parser(_ParseSpec)`

Function Details | [hide private]

### toJavaScript(meta, clause) | source code
Decorators: `@json`

### collapse(tree) | source code
Collapses adjacent and/ors into one statement. and(and(a, b), c) becomes and(a, b, c).

Variables Details | [hide private]

  ### new_name_mapping Value:
      {'eventClass': 'evt.event_class', 'summary': 'evt.summary', 'message':
       'evt.message', 'eventKey': 'evt.event_key', 'agent': 'evt.agent', 'ma
      nager': 'evt.monitor', 'severity': 'evt.severity', 'eventState': 'evt.
      status', 'count': 'evt.count', 'prodState': 'dev.production_state', 'd
      evice': 'elem.name', 'devicePriority': 'dev.priority', 'component': 's
      ub_elem.name', 'eventClassKey': 'evt.event_class_key', 'priority': 'ev
      t.syslog_priority', 'facility': 'evt.syslog_facility', 'ntevid': 'evt.
      nt_event_code', 'ownerId': 'evt.current_user_name', 'deviceClass': 'de
      ...

  ### _Definitions Value:
      r'''
      def u(s):
          # turn string "'fo''o'" -> "fo'o"
          c = s[0]
          s = c.join(s.split(c+c))
          return s[1:-1]

      '''

  ### _ParseSpec Value:
      r'''
      parser WhereClause:
          ignore:    "[ \r\t\n]+"
          token END: "$"
          token NUM: "[0-9]+"
          token VAR: "[a-zA-Z0-9_]+"
          token BIN: ">=|<=|==|=|<|>|!=|<>"
          token STR: r'"([^\\"]+|\\.)*"'
      ...