How to use the persistence.list.PersistentList function in Persistence

To help you get started, we’ve selected a few Persistence examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github owenmorris / chandler / chandler / application / model_deprecated / LocalRepository.py View on Github external
_db = db.DB(_storage)
            _connection = _db.open()
            _dbroot = _connection.root()


            # begin {

            if _use_rap:
                hostname = "localhost"
                repname = "fs-trace-rep"
                _storage.setRepository(hostname, repname, _echo_rap)
            # } end


            if not _dbroot.has_key('classList'):
                _dbroot['classList'] = PersistentList()
            _local_shared_state['classList'] = _dbroot['classList']

            if not _dbroot.has_key('propertyList'):
                _dbroot['propertyList'] = PersistentList()
            _local_shared_state['propertyList'] = _dbroot['propertyList']

            if not _dbroot.has_key('objectList'):
                _dbroot['objectList'] = PersistentList()
            _local_shared_state['objectList'] = _dbroot['objectList']

            transaction.get_transaction().commit()

            # begin {
            if _displayRAPMessages:
                if _echo_rap:
                    if _use_rap:
github owenmorris / chandler / chandler / application / repository / KindOfThing.py View on Github external
def CreateAttributeTemplates(self, attributeTemplateList):
        self[chandler.template] = PersistentList()
        for templateDict in attributeTemplateList:
            self.CreateAttributeTemplate(templateDict)
github scanlime / picogui / pg1 / apps / dev / nifty / Nifty / Poing / Data.py View on Github external
def __init__(self):
        PoingEditable.__init__(self)
        self.fields = persistence.list.PersistentList()
github owenmorris / chandler / chandler / parcels / osaf / contacts / ContactsView.py View on Github external
def __init__(self):
        ViewerParcel.__init__ (self)
        
        # keep a dictionary of the views
        self.views = PersistentList()
        self._InitializeViews()
        self._DeclareNotifications()
        
        # keep some preferences in the persistent object
        self.useOneNameField = True
        self.queryOpen = False
        
        self.currentViewTypeIndex = 0
        self.currentViewIndex = 0
        self.currentZoomIndex = 1

        self.lastContactType = None
        self.lastImageDirectory = None
github owenmorris / chandler / chandler / parcels / osaf / calendar / CalendarViewer.py View on Github external
def __init__(self):
        ViewerParcel.__init__(self)
        self.viewTypes = PersistentList()
        self.viewTypes = (ColumnarViewer(self), MonthViewer(self), TableViewer(self))
        self.remoteAddress = None
        self.currentViewType = 0
        self.showFreeBusy = false
        self.overlayRemoteItems = false
        self.sharingPolicy = 'private'
        self.monthNavigator = MonthNavigator()
github owenmorris / chandler / chandler / parcels / osaf / timeclock / TimeclockView.py View on Github external
def InitializeCustomerList(self):
        self.customerSelection = 0        
        """
        If I make customerList a normal python list, the first version
        would get into the repository, but I wouldn't ever be able to
        append to the list.  Worse, if I later changed customerList from
        a normal list to a PersistentList, I would need to change 
        VERSION in applications/Application.py -- which would invalidate
        any previous data stored in Chandler.  Note that it's *only* variables
        that are in *this* class that need to be persistent.  For example,
        variables in CustomerModel.py do not need to persist.
        """
        self.customerList = PersistentList()
        """
        Yes, yes, I know that hardcoding the customer list is bad bad bad.
        Remember that this is, more than anything else, a *demo*.
        """
        self.customerList.append(CustomerModel("Floss Recycling Incorporated", billingRate=20.778))
        self.customerList.append(CustomerModel("Northside Cowbell Foundry Corp.", billingRate=31))
        self.customerList.append(CustomerModel("Cuneiform Designs, Ltd.", billingRate=17))
        self.currentCustomer = self.customerList[0]
github owenmorris / chandler / chandler / parcels / osaf / repository / RepositoryView.py View on Github external
def AddAttributes(self, attrId, item):
        for key in item.keys():
            element = item[key]
            if isinstance(element, Thing):
                newId = self.treeCtrl.AddNewItem(attrId, key, [element.GetURL()])
                # @@@ FIXME: Note: cycles are possible!
                self.AddAttributes(newId, element)
            elif isinstance(element, types.ListType) or isinstance(element, PersistentList):
                self.AddListItem(element, attrId, key)
            elif isinstance(element, types.TupleType):
                self.AddTupleType(element, attrId, key)
            elif isinstance(element, types.DictType) or isinstance(element, PersistentDict):
                self.AddDictItem(element, attrId, key)
            else:
                self.treeCtrl.AddNewItem(attrId, key, [str(element)])