Package gavo :: Package base :: Module macros :: Class StandardMacroMixin
[frames] | no frames]

Class StandardMacroMixin

source code

  object --+    
           |    
MacroPackage --+
               |
              StandardMacroMixin
Known Subclasses:

is a mixin providing some macros for scripting's MacroExpander.

The class mixing in needs to provide its resource descriptor in the rd attribute.

Instance Methods
 
macro_RSTservicelink(self, serviceId, title=None)
a link to an internal service; id is <rdId>/<serviceId>/<renderer>, title, if given, is the anchor text.
source code
 
macro_RSTtable(self, tableName)
adds an reStructured test link to a tableName pointing to its table info.
source code
 
macro_decapitalize(self, aString)
returns aString with the first character lowercased.
source code
 
macro_getConfig(self, section, name=None)
the current value of configuration item {section}{name}.
source code
 
macro_internallink(self, relPath)
an absolute URL from a path relative to the DC root.
source code
 
macro_magicEmpty(self, val)
returns __EMPTY__ if val is empty.
source code
 
macro_metaSeq(self, metaKey, default='', joiner=', ')
returns all values of metaKey on the current macro expander joined by joiner.
source code
 
macro_metaString(self, metaKey, default=None)
the value of metaKey on the macro expander.
source code
 
macro_rdId(self)
the identifier of the current resource descriptor.
source code
 
macro_rdIdDotted(self)
the identifier for the current resource descriptor with slashes replaced with dots (so they work as the "host part" in URIs.
source code
 
macro_schema(self)
the schema of the current resource descriptor.
source code
 
macro_test(self, *args)
always "test macro expansion".
source code
 
macro_today(self)
today's date in ISO representation.
source code
 
macro_upper(self, aString)
returns aString uppercased.
source code
 
macro_urlquote(self, string)
wraps urllib.quote.
source code

Inherited from MacroPackage: execMacro, expand, getExpander, listMacros, macro_quote, macro_reSub, macro_sql_standardPubDID, macro_sqlquote

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

macro_RSTservicelink(self, serviceId, title=None)

source code 

a link to an internal service; id is <rdId>/<serviceId>/<renderer>, title, if given, is the anchor text.

The result is a link in the short form for restructured test.

macro_getConfig(self, section, name=None)

source code 

the current value of configuration item {section}{name}.

You can also only give one argument to access settings from the general section.

macro_magicEmpty(self, val)

source code 

returns __EMPTY__ if val is empty.

This is necessary when feeding possibly empty params from mixin parameters (don't worry if you don't understand this).

macro_metaSeq(self, metaKey, default='', joiner=', ')

source code 

returns all values of metaKey on the current macro expander joined by joiner.

This will be an empty string if there is no corresponding metadata (or default, if passed).

macro_metaString(self, metaKey, default=None)

source code 

the value of metaKey on the macro expander.

This will raise an error when the meta Key is not available unless you give a default. It will also raise an error if metaKey is not atomic (i.e., single-valued). Use metaSeq for meta items that may have multiple values.

macro_upper(self, aString)

source code 

returns aString uppercased.

There's no guarantees for characters outside ASCII.