コード例 #1
0
ファイル: app.py プロジェクト: c0ns0le/droned
 def __init__(self, original):
     self.process = NullProcess()
     #make an attempt to update the original caller
     if hasattr(original, 'pid'):
         try:
             original.pid = self.process.pid
         except:
             pass
     if hasattr(original, 'inode'):
         try:
             original.inode = self.process.inode
         except:
             pass
コード例 #2
0
ファイル: app.py プロジェクト: c0ns0le/droned
class AdaptToNullProcess(object):
    """I can adapt a L{IDroneModelAppProcess} provider or a 
       L{IDroneModelAppInstance} provider to a L{IKittNullProcess} provider.

       I hold no references to the Original Object after Instantiation.
    """
    implements(IKittNullProcess)

    def __init__(self, original):
        self.process = NullProcess()
        #make an attempt to update the original caller
        if hasattr(original, 'pid'):
            try:
                original.pid = self.process.pid
            except:
                pass
        if hasattr(original, 'inode'):
            try:
                original.inode = self.process.inode
            except:
                pass

    def __getattribute__(self, name):
        try:
            return object.__getattribute__(self, name)
        except:
            return self.process.__getattribute__(name)
コード例 #3
0
ファイル: app.py プロジェクト: mleinart/droned
 def __init__(self, original):
     self.process = NullProcess()
     #make an attempt to update the original caller
     if hasattr(original, 'pid'):
         try: original.pid = self.process.pid
         except: pass
     if hasattr(original, 'inode'):
         try: original.inode = self.process.inode
         except: pass
コード例 #4
0
ファイル: app.py プロジェクト: mleinart/droned
class AdaptToNullProcess(object):
    """I can adapt a L{IDroneModelAppProcess} provider or a 
       L{IDroneModelAppInstance} provider to a L{IKittNullProcess} provider.

       I hold no references to the Original Object after Instantiation.
    """
    implements(IKittNullProcess)
    def __init__(self, original):
        self.process = NullProcess()
        #make an attempt to update the original caller
        if hasattr(original, 'pid'):
            try: original.pid = self.process.pid
            except: pass
        if hasattr(original, 'inode'):
            try: original.inode = self.process.inode
            except: pass

    def __getattribute__(self, name):
        try: return object.__getattribute__(self, name)
        except: return self.process.__getattribute__(name)
コード例 #5
0
ファイル: app.py プロジェクト: c0ns0le/droned
 def __init__(self, original):
     self.process = NullProcess()  #assume the process is dead
     if original.server.hostname == config.HOSTNAME:
         #delay scanning the process, for as long as possible
         try:
             self.process = ProcessSnapshot(original.pid)
         except InvalidProcess:
             pass  #raise all others
     else:
         self.process = RemoteProcess(original.pid)
     #make an attempt to update the original caller
     if hasattr(original, 'pid'):
         try:
             original.pid = self.process.pid
         except:
             pass
     if hasattr(original, 'inode'):
         try:
             original.inode = self.process.inode
         except:
             pass