コード例 #1
0
ファイル: source.py プロジェクト: riverbed/steelscript-appfwk
    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
コード例 #4
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
コード例 #5
0
ファイル: source.py プロジェクト: tagur87/steelscript-appfwk
 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