Browse Source

add a magic resource list that prevents duplicate mime-types from

being added... probably should add more matching, but this is good
for now...

[git-p4: depot-paths = "//depot/": change = 1130]
replace/b43bf02ddeddd088c0e6b94974ca1a46562eb3db
John-Mark Gurney 17 years ago
parent
commit
dacf82263d
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      DIDLLite.py

+ 15
- 0
DIDLLite.py View File

@@ -32,6 +32,21 @@ class Resource:


return root return root


class ResourceList(list):
'''Special class to not overwrite mimetypes that already exist.'''
def __init__(self, *args, **kwargs):
self._mt = {}
list.__init__(self, *args, **kwargs)

def append(self, k):
assert isinstance(k, Resource)
mt = k.protocolInfo.split(':')[2]
if self._mt.has_key(mt):
return

list.append(self, k)
self._mt[mt] = k

class Object(object): class Object(object):
"""The root class of the entire content directory class heirachy.""" """The root class of the entire content directory class heirachy."""




Loading…
Cancel
Save