Exemplo n.º 1
0
def string_file_shortcut(v, item):
    if isinstance(v, str):
        # use proxy class to enable all user conversions on the value itself
        # but return the implementation object (not proxy)
        key = findOutputFileTypeByFileName(v)
        if key is not None:
            if key == 'MassStorageFile':
                from .MassStorageFile import MassStorageFile
                return stripProxy(MassStorageFile._proxyClass(v))
            elif key == 'LCGSEFile':
                from .LCGSEFile import LCGSEFile
                return stripProxy(LCGSEFile._proxyClass(v))
            elif key == 'DiracFile':
                try:
                    from GangaDirac.Lib.Files.DiracFile import DiracFile
                    return stripProxy(DiracFile._proxyClass(v))
                except:
                    Ganga.Utility.logging.log_unknown_exception()
                    pass

        return stripProxy(LocalFile._proxyClass(v))

    return None
Exemplo n.º 2
0
def string_file_shortcut(v, item):
    if isinstance(v, str):
        # use proxy class to enable all user conversions on the value itself
        # but return the implementation object (not proxy)
        key = findOutputFileTypeByFileName(v)
        if key is not None:
            if key == 'MassStorageFile':
                from .MassStorageFile import MassStorageFile
                return stripProxy(MassStorageFile._proxyClass(v))
            elif key == 'LCGSEFile':
                from .LCGSEFile import LCGSEFile
                return stripProxy(LCGSEFile._proxyClass(v))
            elif key == 'DiracFile':
                try:
                    from GangaDirac.Lib.Files.DiracFile import DiracFile
                    return stripProxy(DiracFile._proxyClass(v))
                except:
                    Ganga.Utility.logging.log_unknown_exception()
                    pass

        return stripProxy(LocalFile._proxyClass(v))

    return None