예제 #1
0
    def __init__(self, name):
        Provider.__init__(self, name)

        self.logs = {}
        self.logs['system'] = []
        self._length = 100 # max number of entries
        self._console = True
예제 #2
0
    def __init__(self, name, pool = 10, factory = None, factory_param = [] , factory_param_map = {}, one_per_thread = True, more_stats = False):

        self.name = name
        self._items = []

        self._one_per_thread = one_per_thread
        self._more_stats = more_stats

        # Benchmarking stuff
        self._begin = time.time()
        self._transactions = 0
        self._transit_time = 0


        # So we can issue one per thread automagically
        self._checked_out = {}

        self._sem = Semaphore(0)
        self._pool = pool
        self._factory = factory
        self._factory_param = factory_param
        self._factory_param_map = factory_param_map
        
        Provider.__init__(self, name)

        self.manage_pool()
예제 #3
0
파일: DB.py 프로젝트: theatrus/cymbeline
    def __init__(self, name, db = '', **flags):
        Provider.__init__(self, name)

        if 'dumpinterval' not in flags:
            flags['dumpinterval'] = -1
        if 'autoload' not in flags:
            flags['autoload'] = 1



        self.name = name
        self._wc = 0
        self._rc = 0
        self._stale = 0
        self._commitable = 0
        self._staletime = int(time.time())
        self._dbfile = db

        self.db = {}

        if flags['autoload'] and db:
            try:
                self.loadFromFile()
            except:
                pass # fail silently

        if flags['dumpinterval'] > 0:
            self.GC['/system/timer'].addFunction(self.Timer, flags['dumpinterval'])
예제 #4
0
파일: DB.py 프로젝트: theatrus/cymbeline
 def __init__(self, name):
     
     Provider.__init__(self, name)
     self._name = name
     r = re.compile('/')
     fname = r.sub('_', name) # replace / with _ for file names of database
     self._dbroot = CymMemoryDB(name + '/root', fname + '_root')
     self._dbattr = CymMemoryDB(name + '/attr', fname + '_attr')
예제 #5
0
파일: Auth.py 프로젝트: theatrus/cymbeline
    def __init__(self, name, modules = None, module_root = 'cymbeline.auth'):
        Provider.__init__(self, name)
        self.modules = {}
        self.active_modules = []
        self._module_root = module_root


        # name, class, extra config
        if modules:
            _modules = modules
            self.load_modules(_modules)
예제 #6
0
파일: Player.py 프로젝트: theatrus/shallot
    def __init__(self, gc, name):
        Provider.__init__(self, gc, name)
        self.db = gc['db']
        self.player = audioplay.player.Player()


        
        self.player_manager = PlaylistPlayer(gc,
                                             name + '_playlistplayer_thread',
                                             Playlist(gc, '_library'))


        
        self.player_manager.start()
        self.status = 'Playing'
예제 #7
0
    def __init__(self, name):
        Provider.__init__(self, name)

        
        license = ""

        m = md5.new()   # make environment digest

        file = open('Boostrap.pyo')
        contents = file.readline()
        while contents:
            m.update(contents)
            contents = file.readline()

        # throw in platform + python ver
        m.update(sys.platform)
        (vmajor, vminor, vmicro, vrl, vserial) = sys.version_info
        m.update(`vmajor`)
        m.update(`vminor`)
            
        print
        print "Environment Digest: ", m.hexdigest()
        
        try:
            license = self.GC.getProvider('db_settings').read('_license')
            confirm = self.GC.getProvider('db_settings').read('_license_confirm')
        except:
            print
            print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
            print "No License Key Found"
            sys.stdout.write("Enter license key: ")
            license = sys.stdin.readline().rstrip()

            sys.stdout.write("Enter confirmation code: ")
            confirm = sys.stdin.readline().rstrip()


            print "Validating..."
            self.GC['db_settings'].write('_license', license) #0BAB-12A-87C-76D
            self.GC['db_settings'].write('_license_confirm', confirm)
            
        print "License key: ",license
예제 #8
0
    def __init__(self,  name, instance = 'cymbeline'):
        Provider.__init__(self,name)

        self.remotes = {}
        self.published = {}
        self.instance = instance
        
        
        self.nameserver = RemoteServer( name+"_ns_thread")
        self.nameserver.start()

        time.sleep(0.5)

        
        locator = Pyro.naming.NameServerLocator()
        self.ns = locator.getNS()
        
        self.server = RemoteServer( name + "_srv_thread")

        self.server.start()
        Pyro.core.initClient()
예제 #9
0
파일: DB.py 프로젝트: theatrus/cymbeline
    def __init__(self, name, **flags):
        Provider.__init__(self, name)
        self.name = name

        if 'mode' not in flags:
            flags['mode'] = 'pickle';
        if 'commit' not in flags:
            flags['commit'] = 0
        if 'dumpinterval' not in flags:
            flags['dumpinterval'] = -1
        if 'autoload' not in flags:
            flags['autoload'] = 1
            

        self.flags = flags
        
        r = re.compile('/')

        try:
            self.file_name = self.flags["filename"]
        except:
            self.file_name = r.sub('_', name)
        
        self._root = {}
        self._reads = 0
        self._writes = 0
        self._stale = 0
        self._staletime = int(time.time())

        if flags['autoload']:
            try:
                self.loadFromFile()
            except:
                pass # fail silently

        if flags['dumpinterval'] > 0:
            self.GC['/system/timer'].addFunction(self.Timer, flags['dumpinterval'])
예제 #10
0
    def __init__(self, name):
        Provider.__init__(self, name)

        self.fs = {}
예제 #11
0
    def __init__(self,  name):
        Provider.__init__(self,name)

        self._time = time.time()
예제 #12
0
    def __init__(self,  name, pf_config):
        Provider.__init__(self,  name)

        self.pf_config = pf_config
예제 #13
0
 def __init__(self, gc, name):
     Provider.__init__(self, gc, name)
예제 #14
0
파일: IC.py 프로젝트: theatrus/cymbeline
    def __init__(self, name):
        Provider.__init__(self, name)

        self.commands = {}
        self.command_obj = {'builtin' : IC_Builtins()}
        self.commands.update(self.command_obj['builtin'].commands)
예제 #15
0
    def __init__(self,  name):
        Provider.__init__(self,  name)

        self.thread = TimerThread(name + "_thread")
        self.thread.start()
예제 #16
0
    def __init__(self,  name):
        Provider.__init__(self,  name)

        self.dhclients = {}
예제 #17
0
파일: Library.py 프로젝트: theatrus/shallot
 def __init__(self, gc, name):
     Provider.__init__(self, gc, name)
     self.db = gc['db']