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:

simple static placeholders
        - those are listed in known_placeholders
        - they are used as-is

extended static placeholders
        - those are, effectively, static placeholders
          with a maximum length attached (after "::::")

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...
  lastname = property(_get_lastname, _setter_noop)
  firstname = property(_get_firstname, _setter_noop)
  title = property(_get_title, _setter_noop)
  date_of_birth = property(_get_dob, _setter_noop)
  progress_notes = property(_get_progress_notes, _setter_noop)
  soap = property(_get_progress_notes, _setter_noop)
  soap_s = property(_get_soap_s, _setter_noop)
  soap_o = property(_get_soap_o, _setter_noop)
  soap_a = property(_get_soap_a, _setter_noop)
  soap_p = property(_get_soap_p, _setter_noop)
  soap_u = property(_get_soap_u, _setter_noop)
  soap_admin = property(_get_soap_admin, _setter_noop)
  allergy_state = property(_get_allergy_state, _setter_noop)
  client_version = property(_get_client_version, _setter_noop)
  current_provider = property(_get_current_provider, _setter_noop)
  primary_praxis_provider = property(_get_primary_praxis_provide...
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, _setter_noop)

primary_praxis_provider

Value:
property(_get_primary_praxis_provider, _setter_noop)