Package tdi :: Package tools :: Module javascript :: Class LiteralJSON
[frames] | no frames]

Class LiteralJSON

source code

object --+
         |
        LiteralJSON

Literal JSON container for use with replace or fill

The container just passes its input back through as_json().

Instance Methods
 
__init__(self, json, inlined=False, encoding=None)
Initialization
source code
 
__repr__(self)
Debug representation
source code
unicode
as_json(self, inlined=None)
Content as JSON
source code
unicode
__unicode__(self, inlined=None)
Content as JSON
source code
 
__str__(self)
JSON as str (UTF-8 encoded)
source code

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

Properties

Inherited from object: __class__

Method Details

__init__(self, json, inlined=False, encoding=None)
(Constructor)

source code 
Initialization
Parameters:
  • json (basestring) - JSON to output
  • inlined (bool) - Escape for inlining? See escape_inlined for details.
  • encoding (str) - Encoding of json, in case it's a str. If omitted or None and json is str, json is expected to be UTF-8 encoded (or ASCII only, which is compatible here)
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 
Debug representation
Overrides: object.__repr__

as_json(self, inlined=None)

source code 
Content as JSON
Parameters:
  • inlined (bool or None) - escape for inlining? If omitted or None, the default value from construction is used.
Returns: unicode
JSON string

__unicode__(self, inlined=None)

source code 
Content as JSON
Parameters:
  • inlined (bool or None) - escape for inlining? If omitted or None, the default value from construction is used.
Returns: unicode
JSON string

__str__(self)
(Informal representation operator)

source code 
JSON as str (UTF-8 encoded)
Overrides: object.__str__