Package gavo :: Package base :: Module typesystems :: Class ToPythonCodeConverter
[hide private]
[frames] | no frames]

Class ToPythonCodeConverter

source code

      object --+    
               |    
FromSQLConverter --+
                   |
                  ToPythonCodeConverter

returns code templates to turn literals in variables to python objects.

This is for the rowmakers' src="xx" specification, where no fancy literal processing needs to be done.

The values of the map are simple string interpolation templates, with a single %s for the name of the variable to be converted.

The code assumes whatever executes those literals has done a from gavo.base.literals import *.

Instance Methods [hide private]
 
mapComplex(self, type, length) source code

Inherited from FromSQLConverter: convert

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

Class Variables [hide private]
  typeSystem = 'pythonsrc'
  simpleMap = {'bigint': 'parseInt(%s)', 'boolean': 'parseBoolea...

Inherited from FromSQLConverter (private): _charTypes

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

mapComplex(self, type, length)

source code 
Overrides: FromSQLConverter.mapComplex

Class Variable Details [hide private]

simpleMap

Value:
{'bigint': 'parseInt(%s)',
 'boolean': 'parseBooleanLiteral(%s)',
 'box': '%s',
 'bytea': '%s',
 'char': 'parseUnicode(%s)',
 'date': 'parseDefaultDate(%s)',
 'double precision': 'parseFloat(%s)',
 'file': '%s',
...