- external collection: provide functionality for automatically populate
meta information of media assets
This commit is contained in:
parent
3d53026bdf
commit
6c64ba5158
4 changed files with 33 additions and 5 deletions
|
@ -6,6 +6,8 @@ $Id$
|
|||
1.1
|
||||
---
|
||||
|
||||
- external collection: provide functionality for automatically populate
|
||||
meta information of media assets
|
||||
- new query for retrieving work items independently of task or user
|
||||
- provide additional ``metaInfo`` field, e.g. for storing source and rights
|
||||
information for media assets; show this in info popup;
|
||||
|
|
|
@ -58,6 +58,10 @@ to the external system:
|
|||
>>> aColl01.baseAddress = dataDir
|
||||
>>> aColl01.address = 'topics'
|
||||
|
||||
>>> aColl01.metaInfo = u'Photograph taken by...'
|
||||
>>> aColl01.overwriteMetaInfo is None
|
||||
True
|
||||
|
||||
Directory Collection Provider
|
||||
-----------------------------
|
||||
|
||||
|
@ -128,6 +132,9 @@ can be found.
|
|||
>>> aXf1.storageName, aXf1.storageParams, aXf1.externalAddress
|
||||
('fullpath', {'subdirectory': '...programming'}, 'BeautifulProgram.pdf')
|
||||
|
||||
>>> aXf1.metaInfo
|
||||
u'Photograph taken by...'
|
||||
|
||||
But if one of the referenced objects is not found any more it will be deleted.
|
||||
|
||||
>>> aColl01.address = os.path.join('topics', 'programming', 'zope')
|
||||
|
|
|
@ -116,6 +116,11 @@ class ExternalCollectionAdapter(AdapterBase):
|
|||
# not part of the collection any more
|
||||
# TODO: only remove from collection but keep object?
|
||||
self.remove(old[addr])
|
||||
for r in self.context.getResources():
|
||||
adobj = adapted(r)
|
||||
if self.metaInfo != adobj.metaInfo and (
|
||||
not adobj.metaInfo or self.overwriteMetaInfo):
|
||||
adobj.metaInfo = self.metaInfo
|
||||
self.lastUpdated = datetime.today()
|
||||
|
||||
def clear(self):
|
||||
|
|
|
@ -51,26 +51,26 @@ class IExternalCollection(IConceptSchema, ILoopsAdapter):
|
|||
title=_(u'Provider name'),
|
||||
description=_(u'The name of a utility that provides the '
|
||||
u'external objects; default is a directory '
|
||||
u'collection provider'),
|
||||
u'collection provider.'),
|
||||
required=False)
|
||||
baseAddress = schema.TextLine(
|
||||
title=_(u'Base address'),
|
||||
description=_(u'A base path or URL for accessing this collection '
|
||||
u'on the external system'),
|
||||
u'on the external system.'),
|
||||
required=True)
|
||||
address = schema.TextLine(
|
||||
title=_(u'Relative address'),
|
||||
description=_(u'Optional second (local) part of the '
|
||||
u'collection\'s address'),
|
||||
u'collection\'s address.'),
|
||||
required=False)
|
||||
pattern = schema.TextLine(
|
||||
title=_(u'Selection pattern'),
|
||||
description=_(u'A regular expression for selecting external objects '
|
||||
u'that should belong to this collection'),
|
||||
u'that should belong to this collection.'),
|
||||
required=False)
|
||||
excludeDirectories = schema.Bool(
|
||||
title=_(u'Exclude directories'),
|
||||
description=_(u'Check this if only object directly at the specified '
|
||||
description=_(u'Check this if only objects directly at the specified '
|
||||
u'address should be included in the collection.'),
|
||||
default=False,
|
||||
required=False)
|
||||
|
@ -80,6 +80,20 @@ class IExternalCollection(IConceptSchema, ILoopsAdapter):
|
|||
u'be included.'),
|
||||
value_type=schema.TextLine(),
|
||||
required=False)
|
||||
metaInfo = schema.Text(
|
||||
title=_(u'Meta Information'),
|
||||
description=_(u'A text giving some background information '
|
||||
u'about a media asset, like source, rights, etc.'
|
||||
u'This text will be applied to all resources '
|
||||
u'belonging to this collection.'),
|
||||
default=u'',
|
||||
required=True)
|
||||
overwriteMetaInfo = schema.Bool(
|
||||
title=_(u'Overwrite Meta Information'),
|
||||
description=_(u'Check this if meta information already present '
|
||||
u'should be overwritten by the new text given above.'),
|
||||
default=False,
|
||||
required=False)
|
||||
lastUpdated = Attribute('Date and time of last update.')
|
||||
|
||||
def update():
|
||||
|
|
Loading…
Add table
Reference in a new issue