예제 #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())
예제 #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
예제 #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
예제 #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())
예제 #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