diff --git a/external/annotation.py b/external/annotation.py index 49ffc24..2a33531 100644 --- a/external/annotation.py +++ b/external/annotation.py @@ -23,6 +23,7 @@ $Id$ """ from zope.component import adapts +from zope.dublincore.interfaces import IZopeDublinCore from zope.interface import implements from loops.external.element import Element, elementTypes @@ -47,8 +48,26 @@ class AnnotationsExtractor(object): implements(ISubExtractor) adapts(ILoopsObject) + dcAttributes = ('title', 'description', 'creators', 'created', 'modified') + + def __init__(self, context): + self.context = context + def extract(self): - return [] + dc = IZopeDublinCore(self.context, None) + if dc is not None: + result = {} + for attr in self.dcAttributes: + value = getattr(dc, attr, None) + if attr in ('title',): + if value == getattr(self.context, attr): + value = None + if value: + if attr in ('created', 'modified'): + value = value.strftime('%Y-%m-%dT%H:%M') + result[attr] = value + if result: + yield AnnotationsElement(**result) elementTypes.update(dict( diff --git a/external/base.py b/external/base.py index 3be6522..5559884 100644 --- a/external/base.py +++ b/external/base.py @@ -176,7 +176,7 @@ class Extractor(Base): yield elem childPath = path and '/'.join((path, name)) or name for elem in self.extractNodes(obj, childPath): - self.provideSubElements(obj, elem) + #self.provideSubElements(obj, elem) yield elem # helper methods diff --git a/external/configure.zcml b/external/configure.zcml index b7780ef..5fc223c 100644 --- a/external/configure.zcml +++ b/external/configure.zcml @@ -9,17 +9,18 @@ + + + + - - -