Package Gnumed :: Package wxpython :: Module gmMacro :: Class gmPlaceholderHandler |
[frames] | no frames]

# Class gmPlaceholderHandler

source code

               object --+
                        |
    pycommon.gmBorg.cBorg --+
                            |
                           gmPlaceholderHandler

    Returns values for placeholders.

    - patient related placeholders operate on the currently active patient
    - is passed to the forms handling code, for example

    Return values when .debug is False:
    - errors with placeholders return None
    - placeholders failing to resolve to a value return an empty string

    Return values when .debug is True:
    - errors with placeholders return an error string
    - placeholders failing to resolve to a value return a warning string

    There are several types of placeholders:

    injectable placeholders
            - they must be set up before use by set_placeholder()
            - they should be removed after use by unset_placeholder()
            - the syntax is like extended static placeholders
            - they are listed in _injectable_placeholders

    variant placeholders
            - those are listed in known_variant_placeholders
            - they are parsed into placeholder, data, and maximum length
            - the length is optional
            - data is passed to the handler

    Note that this cannot be called from a non-gui thread unless
    wrapped in wx.CallAfter().

Instance Methods
__init__(self, *args, **kwargs) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
set_placeholder(self, key=None, value=None) | source code
unset_placeholder(self, key=None) | source code
set_cache_value(self, key=None, value=None) | source code
unset_cache_value(self, key=None) | source code
__getitem__(self, placeholder) Map self['placeholder'] to self.placeholder. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Static Methods
Inherited from `pycommon.gmBorg.cBorg`: `__new__`

Class Variables
| escape_style = `property(lambda x: x, _set_escape_style)`
| escape_function = `property(lambda x: x, _set_escape_function)`
| placeholder_regex = `property(lambda x: default_placeholder_reg`...``
| first_order_placeholder_regex = `property(lambda x: first_order`...``
| second_order_placeholder_regex = `property(lambda x: second_ord`...``
| third_order_placeholder_regex = `property(lambda x: third_order`...``

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, *args, **kwargs) (Constructor) | source code
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__ (inherited documentation)

### __getitem__(self, placeholder) (Indexing operator) | source code
Map self['placeholder'] to self.placeholder. This is useful for replacing placeholders parsed out of documents as strings. Unknown/invalid placeholders still deliver a result but it will be glaringly obvious if debugging is enabled.

Class Variable Details

  ### placeholder_regex Value:
      property(lambda x: default_placeholder_regex, lambda x: x)

  ### first_order_placeholder_regex Value:
      property(lambda x: first_order_placeholder_regex, lambda x: x)

  ### second_order_placeholder_regex Value:
      property(lambda x: second_order_placeholder_regex, lambda x: x)

  ### third_order_placeholder_regex Value:
      property(lambda x: third_order_placeholder_regex, lambda x: x)