Browse Source

fix handling updating.. I've been running this for a long time

so I think it's good..

[git-p4: depot-paths = "//depot/": change = 1665]
main
John-Mark Gurney 12 years ago
parent
commit
1499b7a828
1 changed files with 14 additions and 7 deletions
  1. +14
    -7
      DIDLLite.py

+ 14
- 7
DIDLLite.py View File

@@ -265,9 +265,11 @@ class Item(Object):
needupdate = True

def doUpdate(self, child=False):
Container.doUpdate(self.cd[self.parentID])
# do NOT update parent container per 2.2.9 for
# ContainerUpdateID changes
# must be Container.didUpdate, otherwise we could update the
# parent when we really just want to update the ID
Container.didUpdate(self.cd[self.parentID])

def toElement(self):

@@ -327,7 +329,7 @@ class Container(Object, list):
childCount = property(lambda x: len(x))
searchable = None
updateID = 0
needupdate = False
needcontupdate = False

_optionattrs = Object._optionattrs.copy()
_optionattrs.update({
@@ -342,6 +344,7 @@ class Container(Object, list):
Object.__init__(self, cd, id, parentID, title, **kwargs)
list.__init__(self)
self.doingUpdate = False
self.needcontupdate = False
self.oldchildren = {}

def genCurrent(self):
@@ -373,8 +376,8 @@ class Container(Object, list):
if self.doingUpdate:
return
self.doingUpdate = True
self.needcontupdate = False

didupdate = False
children = self.genChildren()
if isinstance(children, dict):
oldchildren = self.oldchildren
@@ -419,17 +422,21 @@ class Container(Object, list):
if klass is not None:
self.cd.addItem(self.id, klass, name, *args,
**kwargs)
didupdate = True
self.needcontupdate = True

# sort our children
self.sort()

if didupdate:
self.didUpdate()

self.doingUpdate = False

if self.needcontupdate:
self.didUpdate()

def didUpdate(self):
if self.doingUpdate:
self.needcontupdate = True
return

if self.id == '0':
self.updateID = (self.updateID + 1)
else:


Loading…
Cancel
Save