Title
+
Description
diff --git a/concept.py b/concept.py
index 4889ee9..ad236ae 100644
--- a/concept.py
+++ b/concept.py
@@ -22,6 +22,7 @@ Definition of the Concept and related classes.
$Id$
"""
+from zope import component, schema
from zope.app import zapi
from zope.app.container.btree import BTreeContainer
from zope.app.container.contained import Contained
@@ -29,8 +30,8 @@ from zope.cachedescriptors.property import Lazy
from zope.component import adapts
from zope.interface import implements
from zope.interface import alsoProvides, directlyProvides, directlyProvidedBy
-from zope import schema
from zope.security.proxy import removeSecurityProxy
+from zope.traversing.api import getName
from persistent import Persistent
from cybertools.relation import DyadicRelation
@@ -83,11 +84,19 @@ class Concept(Contained, Persistent):
proxyInterface = IConceptView
+ def __init__(self, title=u''):
+ self.title = title
+
_title = u''
def getTitle(self): return self._title
def setTitle(self, title): self._title = title
title = property(getTitle, setTitle)
+ _description = u''
+ def getDescription(self): return self._description
+ def setDescription(self, description): self._description = description
+ description = property(getDescription, setDescription)
+
def getConceptType(self):
typePred = self.getConceptManager().getTypePredicate()
if typePred is None:
@@ -107,9 +116,6 @@ class Concept(Contained, Persistent):
self.assignParent(concept, typePred)
conceptType = property(getConceptType, setConceptType)
- def __init__(self, title=u''):
- self.title = title
-
def getLoopsRoot(self):
return zapi.getParent(self).getLoopsRoot()
@@ -299,9 +305,10 @@ class IndexAttributes(object):
def text(self):
context = self.context
# TODO: include attributes provided by concept type
- return ' '.join((zapi.getName(context), context.title,))
+ return ' '.join((getName(context), context.title,))
def title(self):
context = self.context
- return ' '.join((zapi.getName(context), context.title,))
+ return ' '.join((getName(context),
+ context.title, context.description)).strip()
diff --git a/interfaces.py b/interfaces.py
index 061ce98..0db4d8f 100644
--- a/interfaces.py
+++ b/interfaces.py
@@ -74,6 +74,14 @@ class IConcept(ILoopsObject, IPotentialTarget):
default=u'',
required=True)
+ description = schema.Text(
+ title=_(u'Description'),
+ description=_(u'A medium-length description describing the '
+ 'content and the purpose of the object'),
+ default=u'',
+ missing_value=u'',
+ required=False)
+
conceptType = schema.Choice(
title=_(u'Concept Type'),
description=_(u"The type of the concept, specified by a relation to "
@@ -199,6 +207,14 @@ class IBaseResource(ILoopsObject):
missing_value=u'',
required=True)
+ description = schema.Text(
+ title=_(u'Description'),
+ description=_(u'A medium-length description describing the '
+ 'content and the purpose of the object'),
+ default=u'',
+ missing_value=u'',
+ required=False)
+
resourceType = schema.Choice(
title=_(u'Resource Type'),
description=_(u"The type of the resource, specified by a relation to "
@@ -237,6 +253,14 @@ class IResourceSchema(Interface):
missing_value=u'',
required=True)
+ description = schema.Text(
+ title=_(u'Description'),
+ description=_(u'A medium-length description describing the '
+ 'content and the purpose of the object'),
+ default=u'',
+ missing_value=u'',
+ required=False)
+
data = schema.Bytes(
title=_(u'Data'),
description=_(u'Resource raw data'),
@@ -312,7 +336,7 @@ class IDocument(IDocumentSchema, IResource):
"""
-# media asset is probably obsolete - replaced by plain Resource with
+# media asset is obsolete - replaced by plain Resource with
# resourceType = file.
class IMediaAssetView(IResourceSchema):
diff --git a/organize/member.py b/organize/member.py
index 121b88a..785bb71 100644
--- a/organize/member.py
+++ b/organize/member.py
@@ -62,6 +62,7 @@ class MemberRegistrationManager(object):
# step 2: create a corresponding person concept:
cm = self.context.getConceptManager()
id = baseId = 'person.' + userId
+ # TODO: use NameChooser
num = 0
while id in cm:
num +=1
diff --git a/resource.py b/resource.py
index 6f071b1..a51135a 100644
--- a/resource.py
+++ b/resource.py
@@ -22,19 +22,19 @@ Definition of the Concept class.
$Id$
"""
-from zope import component
+from zope import component, schema
from zope.app import zapi
from zope.app.container.btree import BTreeContainer
from zope.app.container.contained import Contained
from zope.app.file.image import Image
from zope.app.file.interfaces import IFile
from zope.filerepresentation.interfaces import IReadFile, IWriteFile
-from zope.size.interfaces import ISized
from zope.cachedescriptors.property import Lazy
from zope.component import adapts
from zope.i18nmessageid import MessageFactory
from zope.interface import implements
-from zope import schema
+from zope.size.interfaces import ISized
+from zope.traversing.api import getName
from persistent import Persistent
from cStringIO import StringIO
@@ -78,7 +78,7 @@ class Resource(Image, Contained):
implements(IBaseResource, IResource, IResourceManagerContained, IRelatable, ISized)
- proxyInterface = IMediaAssetView
+ proxyInterface = IMediaAssetView # obsolete!
_size = _width = _height = 0
@@ -86,6 +86,16 @@ class Resource(Image, Contained):
super(Resource, self).__init__()
self.title = title
+ _title = u''
+ def getTitle(self): return self._title
+ def setTitle(self, title): self._title = title
+ title = property(getTitle, setTitle)
+
+ _description = u''
+ def getDescription(self): return self._description
+ def setDescription(self, description): self._description = description
+ description = property(getDescription, setDescription)
+
def getResourceType(self):
cm = self.getLoopsRoot().getConceptManager()
typePred = cm.getTypePredicate()
@@ -108,11 +118,6 @@ class Resource(Image, Contained):
self.assignConcept(concept, typePred)
resourceType = property(getResourceType, setResourceType)
- _title = u''
- def getTitle(self): return self._title
- def setTitle(self, title): self._title = title
- title = property(getTitle, setTitle)
-
def _setData(self, data):
dataFile = StringIO(data) # let File tear it into pieces
super(Resource, self)._setData(dataFile)
@@ -342,7 +347,8 @@ class IndexAttributes(object):
def title(self):
context = self.context
- return ' '.join((zapi.getName(context), context.title,)).strip()
+ return ' '.join((getName(context),
+ context.title, context.description)).strip()
class ResourceTypeSourceList(object):