def encode(source): """Normalize source values to hashable type for lookups.""" # require a hashable object, see here for simple way to hash dicts: # http://stackoverflow.com/a/16162138/2157429 from steelscript.appfwk.apps.datasource.models import Table return frozenset(Table.to_ref(source).itervalues())
def process_options(cls, table_options): # handle direct id's, table references, or table classes # from tables option and transform to simple table id value for i in ['tables', 'related_tables']: for k, v in (table_options[i] or {}).iteritems(): table_options[i][k] = Table.to_ref(v) tf = table_options['function'] if tf and not isinstance(tf, Function): table_options['function'] = Function(tf) return table_options
def process_options(cls, table_options): # handle direct id's, table references, or table classes # from tables option and transform to simple table id value table_options['base'] = Table.to_ref(table_options['base']) return table_options