Esempio n. 1
0
    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())
Esempio n. 2
0
    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
Esempio n. 3
0
    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
Esempio n. 5
0
 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())
Esempio n. 6
0
 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